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 (profile)
Status: Closed Package: PHAR related
PHP Version: 5.6.18RC1 OS: ubuntu
Private report: No CVE-ID: None
 [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)

Pull Requests

Pull requests:

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC