php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20567 Segmentation fault
Submitted: 2002-11-22 04:29 UTC Modified: 2002-11-22 05:56 UTC
From: matt at zevi dot net Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.3.0RC1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: matt at zevi dot net
New email:
PHP Version: OS:

 

 [2002-11-22 04:29 UTC] matt at zevi dot net
The following code segfaults.

class Class2 extends Class1
{
}

class Class1
{
	function Class2(){
		return new Class2;
	}
}

Class1::Class2();

I don't actually know if it's valid PHP code or not, but I don't think it should segfault either way.

Conditions:
It only happens if Class2 extends Class1.
It only happens if Class2 does not have a constructor.

Confirmed with 4.2.2 and 4.3.0RC1 on Slackware 8.1, 2.4.19 and 4.2.3 on FreeBSD 4.4-RELEASE.

Configure line: './configure' '--with-mysql' '--with-apxs=/usr/sbin/apxs'

I've never done a backtrace before, and I'm not sure I did it right, but hopefully this is of some use to someone...  :)

(gdb) run
Starting program: /usr/local/bin/php index.html

Program received signal SIGSEGV, Segmentation fault.
0x0812cda5 in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1002
1002            EX(fbc) = NULL;
(gdb) bt
#0  0x0812cda5 in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1002
#1  0x081322ea in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1639
#2  0x081322ea in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1639
#3  0x081322ea in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1639
#4  0x081322ea in execute (op_array=0x81b6c34) at /usr/src/php-4.3.0RC1/Zend/zend_execute.c:1639

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-22 05:56 UTC] derick@php.net
You're recursively calling the constructer without end condition so the stack overflows. As per previous discussions we will not make a defence against this.

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC