#24581 [NEW]: usort crashes if the function that it calls is slightly recoursive

From: Date: Thu, 10 Jul 2003 09:26:04 +0000
Subject: #24581 [NEW]: usort crashes if the function that it calls is slightly recoursive
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-43628@lists.php.net to get a copy of this message
From: daniel dot goss at t-systems dot com Operating system: RedHat 8.0, 7.3 PHP version: 4.3.2 PHP Bug Type: Reproducible crash Bug description: usort crashes if the function that it calls is slightly recoursive Description: ------------ The php-engine crashes with a segmentation fault if the function, that is called by usort calls another recursive function. The recoursion deepth is less than 10 so there could not be a global stack overflow. (Tested recursion deepth outside usort min. 8000.) Reproduce code: --------------- <? function MyTest($A, $B, $C, $D, $E, $F, $G) { echo "|".$A++."|<BR>"; flush(); if ($A>10) return 0; MyTest($A, $B, $C, "", "", "", ""); return 0; } function MySort($A, $B) { return MyTest(0,$A,$B,"","","",""); } for ($k=0; $k<100; $k++) { $Test[$k]=rand(1,100); } echo "BEGIN<BR>"; usort($Test, MySort); echo "END<BR>"; ?> Expected result: ---------------- The recursion deepth inside the usort function should be min. 100. Due to the recursive nature of modern sorting algorithms, I understand that the full recursion deepth, like outside of usort, is not available. But it should be much more than 10 (on my system)! Actual result: -------------- [notice] child pid 8651 exit signal Segmentation fault (11) -- Edit bug report at http://bugs.php.net/?id=24581&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24581&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24581&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24581&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24581&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24581&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24581&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24581&r=support Expected behavior: http://bugs.php.net/fix.php?id=24581&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24581&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24581&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24581&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24581&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24581&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24581&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24581&r=gnused

« previous php.bugs (#43628) next »