Bug #69001 [NEW]: PHP crashed when calling zend_error during zend_startup
From: reeze@php.net
Operating system: Any
PHP version: 5.4.37
Package: Reproducible crash
Bug Type: Bug
Bug description:PHP crashed when calling zend_error during zend_startup
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);
--
Edit bug report at https://bugs.php.net/bug.php?id=69001&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69001&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69001&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69001&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69001&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69001&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69001&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69001&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69001&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69001&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69001&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69001&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69001&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69001&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69001&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69001&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69001&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69001&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69001&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69001&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69001&r=mysqlcfg
Thread (4 messages)
- reeze@php.net