From:             eka1970 at mail dot ru
Operating system: red hat 7.3
PHP version:      4.4.0
PHP Bug Type:     Arrays related
Bug description:  memory overwrite

Description:
------------
hundreds of thousands of "$a[]= ..." and "array_pop()" calls triggers
memory overwrite.

Reproduce code:
---------------
<?php

$a = array(0,1,2,3,4,5,6,7,8,9,10);

$paths = array();

$stack = array();
for($i=0; $i<100000; $i++) {
    $steps = mt_rand(2,6);
    // move forward
    for($j=0; $j<$steps; $j++) { $stack[] = array('x'=>$a[$j]); }
    $paths[] = $stack;
    // move backward
    for($j=0; $j<$steps; $j++) { array_pop($stack); }
}

print_r($a);

?>

Expected result:
----------------
array $a is never modified in the code, but when you print it at the end
of the script it spills out a whole lot of unexpected reccursions or just
dies with no output.


-- 
Edit bug report at http://bugs.php.net/?id=34269&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34269&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34269&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34269&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34269&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34269&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34269&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34269&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34269&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34269&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34269&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34269&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34269&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34269&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34269&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34269&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34269&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34269&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34269&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34269&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34269&r=mysqlcfg

Reply via email to