|  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
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
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

attached is a patch against the php 5.6 codebase

use this file in conjunction with the attached testcase

Test script:
Bug #71317: duplicate filenames in tar file cause memory leak
<?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"); ?>
$fname = str_replace('\\', '/', dirname(__FILE__) . '/files/HTML_CSS-1.5.4.tgz');
try {
	$tar = new PharData($fname);
} catch(Exception $e) {
	echo $e->getMessage() . "\n";

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


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


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-29 21:54 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 23:01:29 2024 UTC