#19172 [WFx->Opn]: limited recursive class call results segfault
| From: | alberty at neptunelabs dot de | Date: | Thu, 29 Aug 2002 14:31:30 +0000 |
| Subject: | #19172 [WFx->Opn]: limited recursive class call results segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18156@lists.php.net to get a copy of this message | ||
ID: 19172
User updated by: alberty@neptunelabs.de
Reported By: alberty@neptunelabs.de
-Status: Won't fix
+Status: Open
Bug Type: Reproducible crash
Operating System: i686-pc-linux-gnu
PHP Version: 4CVS-2002-08-29
New Comment:
Yes, i know, but you have not read the script.
I have declared $stopper as static!
And also this script without any initializing
also crashes:
<?php
class foo {
var $stopper=0;
function out(){
if ($this->stopper < 10) $this->out();
$this->stopper++;
}
}
$foo = new foo;
$foo->out();
?>
backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x4044d45d in zend_clean_garbage () at
/usr/src/php4/Zend/zend_execute_locks.h:24
24 {
(gdb) bt
#0 0x4044d45d in zend_clean_garbage () at
/usr/src/php4/Zend/zend_execute_locks.h:24
#1 0x40446b66 in execute (op_array=0x816c314) at
/usr/src/php4/Zend/zend_execute.c:1054
#2 0x40449b55 in execute (op_array=0x816c314) at
/usr/src/php4/Zend/zend_execute.c:1643
#3 0x40449b55 in execute (op_array=0x816c314) at
/usr/src/php4/Zend/zend_execute.c:1643
Regards,
Steve
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 10:22:14] derick@php.net
erm,
you're initializing the variable to 0 every time you enter this
function, and the result will be that this function keeps calling
itself indefinetely.
As disucussed on the dev list before we will not fix this.
Derick
------------------------------------------------------------------------
[2002-08-29 10:19:00] alberty@neptunelabs.de
Hi,
the follow call results a segfault:
<?php
class foo {
function out(){
static $stopper=0;
if ($stopper < 10) $this->out();
$stopper++;
}
}
$foo = new foo;
$foo->out();
?>
Tested with gcc3.1.1 and libc2.2.4
here is the backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x4044d4cc in _get_zval_ptr (node=0x816b018, Ts=0xbf8000bc,
should_free=0xbf80008c) at /usr/src/php4/Zend/zend_execute.c:71
71 {
(gdb) bt
#0 0x4044d4cc in _get_zval_ptr (node=0x816b018, Ts=0xbf8000bc,
should_free=0xbf80008c) at /usr/src/php4/Zend/zend_execute.c:71
#1 0x40445495 in zend_fetch_var_address (opline=0x816b004,
Ts=0xbf8000bc, type=1) at /usr/src/php4/Zend/zend_execute.c:529
#2 0x40447900 in execute (op_array=0x816bf34) at
/usr/src/php4/Zend/zend_execute.c:1237
#3 0x40449b55 in execute (op_array=0x816bf34) at
/usr/src/php4/Zend/zend_execute.c:1643
#4 0x40449b55 in execute (op_array=0x816bf34) at
/usr/src/php4/Zend/zend_execute.c:1643
#5 0x40449b55 in execute (op_array=0x816bf34) at
/usr/src/php4/Zend/zend_execute.c:1643
...
Regards,
Steve
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19172&edit=1