Bug #76524 [NEW]: ZipArchive memory leak (OVERWRITE flag and empty archive)
| From: | timok at ya dot ru | Date: | Sun, 24 Jun 2018 18:43:07 +0000 |
| Subject: | Bug #76524 [NEW]: ZipArchive memory leak (OVERWRITE flag and empty archive) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215955@lists.php.net to get a copy of this message | ||
From: timok at ya dot ru
Operating system:
PHP version: 5.6.36
Package: Zip Related
Bug Type: Bug
Bug description:ZipArchive memory leak (OVERWRITE flag and empty archive)
Description:
------------
The memory leak occurs when
- ZipArchive is opened with ZipArchive::CREATE|ZipArchive::OVERWRITE
flags,
- it's empty,
- it's destroyed without explicit close() method call.
The leak does not occur if zip-file already exist.
All PHP versions are affected.
Test script:
---------------
$zip = new ZipArchive();
$zip->open(__DIR__.'/nonexistent.zip', ZipArchive::CREATE |
ZipArchive::OVERWRITE);
Expected result:
----------------
Done
Warning: Unknown: Cannot destroy the zip context in Unknown on line 0
Actual result:
--------------
Done
Warning: Unknown: Cannot destroy the zip context in Unknown on line 0
[Sun Jun 24 20:52:32 2018] Script: '...'
/.../php-src/ext/zip/php_zip.c(1141) : Freeing 0x7FED6E9998B8 (80
bytes), script=...
[Sun Jun 24 20:52:32 2018] Script: '...'
/.../php-src/main/fopen_wrappers.c(808) : Freeing 0x7FED6E99A090 (41
bytes), script=...
=== Total 2 memory leaks detected ===
--
Edit bug report at https://bugs.php.net/bug.php?id=76524&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76524&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76524&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76524&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76524&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76524&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76524&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76524&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76524&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76524&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76524&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76524&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76524&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76524&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76524&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76524&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76524&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76524&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76524&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76524&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76524&r=mysqlcfg