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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 01:01:28 2024 UTC