[php-src] PR #13613: Fix GH-13612: Corrupted memory in destructor with weak references
| From: | nielsdos | Date: | Wed, 06 Mar 2024 22:30:53 +0000 |
| Subject: | [php-src] PR #13613: Fix GH-13612: Corrupted memory in destructor with weak references | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25282@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13613
Author: nielsdos
Inside
zend_object_std_dtor the weakrefs are notified after the destruction of
properties already took place. In this test case, the destructor of an anon class will be invoked
due to the property destruction. That class has a weak reference to its parent. This means that the
destructor can access parent properties that already have been destroyed, resulting in a UAF. Fix
this by notifying the weakrefs at the start of the object's destruction.