Bug #78973 [NEW]: Destructor during CV freeing causes segfault if opline never saved
| From: | nikic@php.net | Date: | Mon, 16 Dec 2019 17:45:13 +0000 |
| Subject: | Bug #78973 [NEW]: Destructor during CV freeing causes segfault if opline never saved | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224347@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: 7.4Git-2019-12-16 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Destructor during CV freeing causes segfault if opline never saved
Description:
------------
If global regs are used, and during the execution of a function the
opline is never stored, then a destructor call during CV freeing may
result in a segfault when attempting to read the current opline in
zend_call_function.
==20975== Use of uninitialised value of size 8
==20975== at 0x91F333: zend_call_function (zend_execute_API.c:678)
==20975== by 0x9895DE: zend_objects_destroy_object
(zend_objects.c:179)
==20975== by 0x990A30: zend_objects_store_del
(zend_objects_API.c:178)
==20975== by 0x93489B: rc_dtor_func (zend_variables.c:57)
==20975== by 0x9A6C9C: i_free_compiled_variables
(zend_execute.c:3407)
==20975== by 0xA10528: execute_ex (zend_vm_execute.h:53450)
==20975== by 0xA14ACB: zend_execute (zend_vm_execute.h:57669)
==20975== by 0x938F4A: zend_execute_scripts (zend.c:1665)
==20975== by 0x89B078: php_execute_script (main.c:2619)
==20975== by 0xA1769D: do_cli (php_cli.c:961)
==20975== by 0xA18807: main (php_cli.c:1352)
In PHP 7.3 this did not happen, because EX(opline) was always written
during execute_data initialization. However, the behavior may not have
been exactly right, as the opline might still have been stale.
Test script:
---------------
<?php
function test($x) {
}
test(new class {
public function __destruct() {
}
});
--
Edit bug report at https://bugs.php.net/bug.php?id=78973&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78973&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78973&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78973&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78973&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78973&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78973&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78973&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78973&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78973&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78973&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78973&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78973&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78973&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78973&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78973&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78973&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78973&r=mysqlcfg