mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The element may be still in use in other places, so the linking pointers should be kept consistent. If not consistent, the "move forward" code in the sample test will read a stale, dangling pointer. Closes GH-20885.
27 lines
446 B
PHP
27 lines
446 B
PHP
--TEST--
|
|
GH-20856 (heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration)
|
|
--CREDITS--
|
|
vi3tL0u1s
|
|
iluuu1994
|
|
--FILE--
|
|
<?php
|
|
$m = new SplStack;
|
|
$m[] = new stdClass;
|
|
$m[] = new stdClass;
|
|
|
|
foreach ($m as $l) {
|
|
unset($m[0]);
|
|
unset($m[0]);
|
|
}
|
|
|
|
var_dump($m);
|
|
?>
|
|
--EXPECTF--
|
|
object(SplStack)#%d (%d) {
|
|
["flags":"SplDoublyLinkedList":private]=>
|
|
int(6)
|
|
["dllist":"SplDoublyLinkedList":private]=>
|
|
array(0) {
|
|
}
|
|
}
|