php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17945 (inifinitive) recursive function call causes segmentation fault
Submitted: 2002-06-24 09:21 UTC Modified: 2002-06-24 09:25 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: tilman dot giese at globalview dot de Assigned:
Status: Wont fix Package: Reproducible crash
PHP Version: 4.2.1 OS: SuSE Linux 7.3
Private report: No CVE-ID: None
 [2002-06-24 09:21 UTC] tilman dot giese at globalview dot de
I wrote a class with a function to add a key to an assoziative array. Unfortunately, I got an infinite loop when changing function names. Therefore, I got a segmentation fault in apache. The function looks like this:

function setAttribute($name, $value) {
	if (array_key_exists($name, $this->cfgAttributes) && trim($value)) {
		return $this->setAttribute($this->cfgAttributes[$name], $this->encode($value));
	} else return false;
}

The reproducible segmentation fault looks like:

#0  0x400f4ae5 in chunk_free () from /lib/libc.so.6
#1  0x400f49a3 in free () from /lib/libc.so.6
#2  0x40322a9c in shutdown_memory_manager (silent=1, clean_cache=0) at zend_alloc.c:468
#3  0x403490b5 in php_request_shutdown (dummy=0x0) at main.c:794
#4  0x40345b93 in apache_php_module_main (r=0x814b0e8, display_source_mode=0) at sapi_apache.c:96
#5  0x403466ff in send_php (r=0x814b0e8, display_source_mode=0, filename=0x0) at mod_php4.c:575
#6  0x40346763 in send_parsed_php (r=0x814b0e8) at mod_php4.c:590
#7  0x08056819 in ap_invoke_handler ()
#8  0x0806d1bf in process_request_internal ()
#9  0x0806d232 in ap_process_request ()
#10 0x080638a6 in child_main ()
#11 0x08063a85 in make_child ()
#12 0x08063c06 in startuo_children ()
#13 0x080642ad in standalone_main ()
#14 0x08064b3c in main ()
#15 0x4009d7ee in __libc_start_main () from /lib/libc.so.6

I solved the problem because it was only a spelling mistake, but php should not produce a segmentation fault, does not it?

Tilman

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-24 09:25 UTC] mfischer@php.net
There are no checks to PHP is free to crash if developers are don't watch out/code stupid (no offensive, but that's the real world).

You can use something like google.com/search?q=xdebug which has recusrive protection.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC