Bug #71504 [Opn->Csd]: Parsing of tar file with duplicate filenames causes memory leak

From: Date: Mon, 29 Feb 2016 21:54:06 +0000
Subject: Bug #71504 [Opn->Csd]: Parsing of tar file with duplicate filenames causes memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199536@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71504&edit=1

 ID:                 71504
 Updated by:         nikic@php.net
 Reported by:        zawadi at gmail dot com
 Summary:            Parsing of tar file with duplicate filenames causes
                     memory leak
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            PHAR related
 Operating System:   ubuntu
 PHP Version:        5.6.18RC1
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Fixed with https://github.com/php/php-src/commit/50b4cafd286eb9d96d71df04e8dc46d321d420b5.


Previous Comments:
------------------------------------------------------------------------
[2016-02-03 09:36:58] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71504&edit=1


Thread (2 messages)

« previous php.bugs (#199536) next »