#39046 [NEW]: double free on circular references

From: Date: Thu, 05 Oct 2006 11:07:47 +0000
Subject: #39046 [NEW]: double free on circular references
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103123@lists.php.net to get a copy of this message
From: checat at yandex dot ru Operating system: RHEL4 PHP version: 4.4.4 PHP Bug Type: Reproducible crash Bug description: double free on circular references Description: ------------ When freeing array variables with multiple references, variables which should still be accessible via other reference may be unexpectedly freed. Depending of the code it may produce data corruption, glibc-detected memory corruption or segfault. Reproduce code: --------------- <?php $root=array('id'=>'1', 'parent_id'=>NULL); $child1 = array('id'=>'2', 'parent_id'=>'1'); // build tree with references up and down $root['childs'] = array(); $child1['parent'] = & $root; $child1['parent']['childs'][] = & $child1; $child1['childs'] = array(); print_r($root['childs'][0]['childs']); unset($child1); print_r($root['childs'][0]['childs']); ?> Expected result: ---------------- Array ( ) Array ( ) Actual result: -------------- CGI: Array ( ) Array ( ) Segmentation fault Apache2/prefork/mod_php: no output, Segmentation fault in log -- Edit bug report at http://bugs.php.net/?id=39046&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39046&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39046&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39046&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39046&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39046&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39046&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39046&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39046&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39046&r=support Expected behavior: http://bugs.php.net/fix.php?id=39046&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39046&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39046&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39046&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39046&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39046&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39046&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39046&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39046&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39046&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39046&r=mysqlcfg

« previous php.bugs (#103123) next »