mirror of
https://github.com/php/php-src.git
synced 2024-09-21 01:47:25 +00:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-15837: Segmentation fault in ext/simplexml/simplexml.c
This commit is contained in:
commit
0d9b039568
4
NEWS
4
NEWS
@ -12,6 +12,10 @@ PHP NEWS
|
||||
- PCRE:
|
||||
. Fix UAF issues with PCRE after request shutdown. (nielsdos)
|
||||
|
||||
- SimpleXML:
|
||||
. Fixed bug GH-15837 (Segmentation fault in ext/simplexml/simplexml.c).
|
||||
(nielsdos)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #73182 (PHP SOAPClient does not support stream context HTTP
|
||||
headers in array form). (nielsdos)
|
||||
|
@ -2487,6 +2487,11 @@ static void php_sxe_iterator_current_key(zend_object_iterator *iter, zval *key)
|
||||
{
|
||||
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
|
||||
zval *curobj = &iterator->sxe->iter.data;
|
||||
if (Z_ISUNDEF_P(curobj)) {
|
||||
ZVAL_NULL(key);
|
||||
return;
|
||||
}
|
||||
|
||||
php_sxe_object *intern = Z_SXEOBJ_P(curobj);
|
||||
|
||||
xmlNodePtr curnode = NULL;
|
||||
|
30
ext/simplexml/tests/gh15837.phpt
Normal file
30
ext/simplexml/tests/gh15837.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
GH-15837 (Segmentation fault in ext/simplexml/simplexml.c)
|
||||
--CREDITS--
|
||||
YuanchengJiang
|
||||
--FILE--
|
||||
<?php
|
||||
$xml =<<<EOF
|
||||
<xml>
|
||||
<fieldset1>
|
||||
</fieldset1>
|
||||
<fieldset2>
|
||||
<options>
|
||||
</options>
|
||||
</fieldset2>
|
||||
</xml>
|
||||
EOF;
|
||||
$sxe = new SimpleXMLIterator($xml);
|
||||
$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
foreach ($rit as $child) {
|
||||
$ancestry = $child->xpath('ancestor-or-self::*');
|
||||
// Exhaust internal iterator
|
||||
foreach ($ancestry as $ancestor) {
|
||||
}
|
||||
}
|
||||
var_dump($rit->valid());
|
||||
var_dump($rit->key());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
NULL
|
Loading…
Reference in New Issue
Block a user