php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24578 A stack overflow in a php-script leads to a segmentation fault.
Submitted: 2003-07-10 03:34 UTC Modified: 2003-07-13 10:51 UTC
Votes:8
Avg. Score:4.8 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:2 (33.3%)
Same OS:0 (0.0%)
From: daniel dot goss at t-systems dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.3.2 OS: RedHat 8.0, 7.3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-07-10 03:34 UTC] daniel dot goss at t-systems dot com
Description:
------------
I know this bug has been reported as "Bug #18909: Stack overflow error" but I think this should be fixed and not treated as bogus like in bug #18909.
Scripting engines should _never_ segfault!

A stack overflow in a recursive php-function leads the php-engine to a segmentation fault.

There is a second issue that could be in associated with this one. If a function is called very often (sometimes recoursive - depth not greater than 20) php crashes too. We've not investigated this issue further enough to write a script to reproduce this behaviour.

Reproduce code:
---------------
<?
  function MyTest($A, $B, $C, $D, $E, $F, $G)
  {
  	for ($k=0; $k<100; $k++)
    {
	    echo "|".$A++."|<BR>";
  	  flush();    
  		MyTest($A, "", "", "", "", "", "");
    }
  }
  
  MyTest(0,"","","","","","");
?>


Expected result:
----------------
A php error complaining about a stack overflow.

Actual result:
--------------
[notice] child pid 29029 exit signal Segmentation fault (11)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-11 02:56 UTC] bharat at menalto dot com
Here's a very simple test case to reproduce this bug:

<?php
function crash($data) { 
    crash(1); 
} 
 
crash(1); 
?>
 [2003-07-11 03:07 UTC] daniel dot goss at t-systems dot com
We've investigates the "second issue" and have reported it under Bug #24581.
 [2003-07-13 10:51 UTC] sniper@php.net
This won't be "fixed". Just don't do this.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 02:05:43 2022 UTC