php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14833 Crash with referense in bogus code
Submitted: 2002-01-03 16:24 UTC Modified: 2002-08-22 12:06 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: sitnikov at infonet dot ee Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.1.1 OS: Linux
Private report: No CVE-ID: None
 [2002-01-03 16:24 UTC] sitnikov at infonet dot ee
<? 
   function &foo(&$str) {
     //$str = str_replace("a", "b", $str);  // line *
     return $str;
   }

   echo $str = &foo($str = "aaaaaaaaa");
?>

   If uncommect line *, we not have 'Segmentation', but have unpredictable behavior.
 
   P.S. I know that it bogus code

(gdb) run -f 1.php
Starting program: php -f ~/public_html/test/1.php
Program received signal SIGSEGV, Segmentation fault.
chunk_free (ar_ptr=0x4060adc0, p=0x82dc080) at malloc.c:3049
3049    malloc.c: No such file or directory.
        in malloc.c
(gdb) bt
#0  chunk_free (ar_ptr=0x4060adc0, p=0x82dc080) at malloc.c:3049
#1  0x40575f9a in __libc_free (mem=0x82dc088) at malloc.c:3023
#2  0x080c800b in _efree (ptr=0x82dc094) at zend_alloc.c:246
#3  0x080c84a1 in shutdown_memory_manager (silent=1, clean_cache=0) at zend_alloc.c:469
#4  0x080772e4 in php_request_shutdown (dummy=0x0) at main.c:742
#5  0x080737ef in main (argc=3, argv=0xbffff9a4) at cgi_main.c:776
#6  0x405349cb in __libc_start_main (main=0x8072ebc <main>, argc=3, argv=0xbffff9a4, init=0x806ffa8 <_init>, 
    fini=0x81b1ff0 <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffff99c) 
at ../sysdeps/generic/libc-start.c:92


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-09 22:00 UTC] yohgaki@php.net
Verified.
 [2002-08-22 12:06 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 22:01:30 2024 UTC