php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1920 limit on number of function calls (non recursive)
Submitted: 1999-07-29 06:41 UTC Modified: 1999-07-29 08:28 UTC
From: alan at gocdo dot net dot au Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0 Latest CVS (29/07/1999) OS: RH Linux 5.2
Private report: No CVE-ID: None
 [1999-07-29 06:41 UTC] alan at gocdo dot net dot au
the latest  (1999-07-29 10:30:00 GMT) cvs compiled as a cgi binary the  
following  (non recursive) script...
=====================
<?php
 
$count=0;
while(true){
        one(&$count);
}
 
function one($count){
        echo $count."\n";
        $count++;
}
 
?>  
===================

...causes the following error;
.

.
.
5459
5460
<br>
<b>Fatal error</b>:  Allowed memory size of 120000000 bytes exhausted at zend_ptr_stack.c:38 (tried to allocate -196608 bytes) in <b>bigarray.php</b> on line <b>5</b><br>
[alan@gocdo]$

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-29 07:27 UTC] danny at cvs dot php dot net
If you put the function definition before the main program 
(as one usually does), your script works perfectly well on my system with the current CVS.

However, your script "as is" gives me a segfault :

Program received signal SIGSEGV, Segmentation fault.
0x807bdeb in zend_ptr_stack_push (stack=0x81f2c78, ptr=0x8070719) at zend_ptr_stack.c:42
42              *(stack->top_element++) = ptr;
(gdb) bt
#0  0x807bdeb in zend_ptr_stack_push (stack=0x81f2c78, ptr=0x8070719) at zend_ptr_stack.c:42
#1  0x8084c6a in execute (op_array=0x820bb70) at zend_execute.c:1309
#2  0x806a583 in php_execute_script (primary_file=0xbffffc04) at main.c:1131
#3  0x806f349 in main (argc=2, argv=0xbffffc28) at cgi_main.c:448

 [1999-07-29 08:28 UTC] andi at cvs dot php dot net
Fixed in latest CVS.
Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 07:01:30 2024 UTC