php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69001 PHP crashed when calling zend_error during zend_startup
Submitted: 2015-02-07 05:52 UTC Modified: 2016-04-17 04:22 UTC
From: reeze@php.net Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.4.37 OS: Any
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: reeze@php.net
New email:
PHP Version: OS:

 

 [2015-02-07 05:52 UTC] reeze@php.net
Description:
------------
https://github.com/php/php-src/blob/PHP-5.4/main/main.c#L2037-L2051

EG()/PG() are initialized after zend_startup().  zend_error() assumed EG()
are initialized correctly, when build with ZTS, EG() are not correct
initialized, this will crash PHP if there is a branch called zend_error()
function.


This seems exist since PHP4.0


Test script:
---------------
None:

You could try to adding a zend_error() call to this line: https://github.com/php/php-src/blob/PHP-5.4/main/main.c#L2039  


Expected result:
----------------
No crash

Actual result:
--------------
* thread #1: tid = 0x1dc8e, 0x000000010020109e php`php_error_cb(type=2, error_filename=0x000000010042ae0c, error_lineno=0, format=0x0000000100446dd7, args=0x00007fff5fbff370) + 94 at main.c:952, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x48)
    frame #0: 0x000000010020109e php`php_error_cb(type=2, error_filename=0x000000010042ae0c, error_lineno=0, format=0x0000000100446dd7, args=0x00007fff5fbff370) + 94 at main.c:952
   949 		int buffer_len, display;
   950 		TSRMLS_FETCH();
   951 	
-> 952 		buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-04 21:13 UTC] kalle@php.net
Is there an actual error that can occur this early on in the startup stage? If so, do you have a script to reproduce such?
 [2016-04-04 21:13 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2016-04-17 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 02:05:45 2022 UTC