Bug #78973 [Opn->Csd]: Destructor during CV freeing causes segfault if opline never saved
| From: | nikic@php.net | Date: | Mon, 16 Dec 2019 17:54:15 +0000 |
| Subject: | Bug #78973 [Opn->Csd]: Destructor during CV freeing causes segfault if opline never saved | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224348@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78973&edit=1
ID: 78973
Updated by: nikic@php.net
Reported by: nikic@php.net
Summary: Destructor during CV freeing causes segfault if
opline never saved
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.4Git-2019-12-16 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=11b041d3c6f65ba7539c61edcf9587618af1ed43
Log: Fixed bug #78973
Previous Comments:
------------------------------------------------------------------------
[2019-12-16 17:45:13] nikic@php.net
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 this bug report at https://bugs.php.net/bug.php?id=78973&edit=1