mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #80268: loadHTML() truncates at NUL bytes
This commit is contained in:
commit
e71036ce03
3
NEWS
3
NEWS
@ -13,6 +13,9 @@ PHP NEWS
|
||||
- COM:
|
||||
. Fixed bug #62474 (com_event_sink crashes on certain arguments). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #80268 (loadHTML() truncates at NUL bytes). (cmb)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #76618 (segfault on imap_reopen). (girgias)
|
||||
. Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb)
|
||||
|
@ -1840,7 +1840,6 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
}
|
||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||
} else {
|
||||
source_len = xmlStrlen((xmlChar *) source);
|
||||
if (ZEND_SIZE_T_INT_OVFL(source_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "Input string is too long");
|
||||
RETURN_FALSE;
|
||||
|
24
ext/dom/tests/bug80268.phpt
Normal file
24
ext/dom/tests/bug80268.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #80268 (loadHTML() truncates at NUL bytes)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DOMDocument;
|
||||
$doc->loadHTML("<p>foo\0bar</p>");
|
||||
$html = $doc->saveHTML();
|
||||
var_dump(strpos($html, '<p>foo</p>') !== false);
|
||||
|
||||
file_put_contents(__DIR__ . '/80268.html', "<p>foo\0bar</p>");
|
||||
$doc = new DOMDocument;
|
||||
$doc->loadHTMLFile(__DIR__ . '/80268.html');
|
||||
$html = $doc->saveHTML();
|
||||
var_dump(strpos($html, '<p>foo</p>') !== false);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/80268.html');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
Loading…
Reference in New Issue
Block a user