php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71504 Parsing of tar file with duplicate filenames causes memory leak
Submitted: 2016-02-03 09:36 UTC Modified: 2016-02-29 21:54 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: zawadi at gmail dot com Assigned: nikic
Status: Closed Package: PHAR related
PHP Version: 5.6.18RC1 OS: ubuntu
Private report: No CVE-ID:
 [2016-02-03 09:36 UTC] zawadi at gmail dot com
Description:
------------
When parsing a tar file with duplicate filenames there is a memoryleak when registering subsequent filenames.

This is actually the same bug as has been reported https://bugs.php.net/bug.php?id=71317

attached is a patch against the php 5.6 codebase

use this file in conjunction with the attached testcase
http://download.pear.php.net/package/HTML_CSS-1.5.4.tgz

Test script:
---------------
--TEST--
Bug #71317: duplicate filenames in tar file cause memory leak
--SKIPIF--
<?php if (!extension_loaded('phar')) die('skip'); ?>
<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
--FILE--
<?php
$fname = str_replace('\\', '/', dirname(__FILE__) . '/files/HTML_CSS-1.5.4.tgz');
try {
	$tar = new PharData($fname);
} catch(Exception $e) {
	echo $e->getMessage() . "\n";
}
?>
===DONE===
--EXPECT--
===DONE===


Expected result:
----------------
when running with ENABLE_MAINTAINER_ZTS=1 enabled the test should report a memoryleak.


Patches

patch.txt (last revision 2016-02-03 09:37 UTC) by zawadi at gmail dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-29 21:54 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue May 23 14:01:44 2017 UTC