mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Not enough space was reserved for the packed resulting array because of some confusion in the meaning of nr of used slots vs nr of elements. Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
21 lines
350 B
PHP
21 lines
350 B
PHP
--TEST--
|
|
GH-11016 (Heap buffer overflow in ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER)
|
|
--FILE--
|
|
<?php
|
|
function number() {
|
|
return 6;
|
|
}
|
|
|
|
// We need to use a function to trick the optimizer *not* to optimize the array to a constant
|
|
$x = [number() => 0, ...[1, 1, 1]];
|
|
print_r($x);
|
|
?>
|
|
--EXPECT--
|
|
Array
|
|
(
|
|
[6] => 0
|
|
[7] => 1
|
|
[8] => 1
|
|
[9] => 1
|
|
)
|