php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22831 Segfault when calling a function recursively
Submitted: 2003-03-23 14:04 UTC Modified: 2003-03-23 14:45 UTC
From: ja at morrdusk dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.2RC1 OS: Mac OS X 10.2.4
Private report: No CVE-ID: None
 [2003-03-23 14:04 UTC] ja at morrdusk dot net
I expected an out of memory error or something similar but instead I got a segmentation fault when executing the following script:

<?php

function foo()
{
        foo();
}

foo();

?>

$ php foo.php 
zsh: 20003 segmentation fault  php foo.php

Gdb output, the backtrace was huge so I only included the first 10 lines:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x900042f0 in free_list_add_ptr ()
(gdb) bt
#0  0x900042f0 in free_list_add_ptr ()
#1  0x90004a44 in malloc_zone_malloc ()
#2  0x000c1294 in _emalloc (size=40) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_alloc.c:158
#3  0x000e0314 in execute (op_array=0x44225c) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1627
#4  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#5  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#6  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#7  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#8  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#9  0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650
#10 0x000e0404 in execute (op_array=0x476c20) at /Volumes/Data/apps/php/php-4.3.2RC1/Zend/zend_execute.c:1650

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-23 14:45 UTC] magnus@php.net
Search the older reports before reporting, there might be
someone that have repotred it earlier (in this case a zillion
times). This won't be fixed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 22 06:00:02 2025 UTC