Bug #78589 [NEW]: Memory leak with GC + __destruct()
| From: | nikic@php.net | Date: | Mon, 23 Sep 2019 10:20:38 +0000 |
| Subject: | Bug #78589 [NEW]: Memory leak with GC + __destruct() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222888@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: 7.4Git-2019-09-23 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Memory leak with GC + __destruct()
Description:
------------
This is reduced from an OSS-Fuzz testcase involving unserialize(), but
turns out to be some kind of generic GC bug. It is related to the
changes to __destruct() handling in 7.4.
Test script:
---------------
class Test {
public function __destruct() {}
}
$test = new Test;
$test->foo = [&$test->foo];
$ary = [&$ary, $test];
unset($ary, $test);
gc_collect_cycles();
Actual result:
--------------
[Mon Sep 23 12:17:48 2019] Script:
'/home/nikic/php-src-fuzz/t009.php'
Zend/zend_vm_execute.h(27609) : Freeing 0x00007f8220201940 (32 bytes),
script=/home/nikic/php-src-fuzz/t009.php
[Mon Sep 23 12:17:48 2019] Script:
'/home/nikic/php-src-fuzz/t009.php'
/home/nikic/php-src-fuzz/Zend/zend_hash.c(256) : Freeing
0x00007f82202588a0 (56 bytes), script=/home/nikic/php-src-fuzz/t009.php
[Mon Sep 23 12:17:48 2019] Script:
'/home/nikic/php-src-fuzz/t009.php'
/home/nikic/php-src-fuzz/Zend/zend_hash.c(131) : Freeing
0x00007f822025c280 (264 bytes),
script=/home/nikic/php-src-fuzz/t009.php
=== Total 3 memory leaks detected ===
--
Edit bug report at https://bugs.php.net/bug.php?id=78589&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78589&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78589&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78589&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78589&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78589&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78589&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78589&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78589&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78589&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78589&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78589&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78589&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78589&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78589&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78589&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78589&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78589&r=mysqlcfg