Skip to content

Commit 635ba1f

Browse files
committed
Merge branch 'bug71354' into PHP-5.5.32
* bug71354: Fix bug #71354 - remove UMR when size is 0
2 parents aa8d3a8 + 13ad4d3 commit 635ba1f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4884,6 +4884,7 @@ PHP_METHOD(PharFileInfo, getContent)
48844884

48854885
phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC);
48864886
Z_TYPE_P(return_value) = IS_STRING;
4887+
Z_STRVAL_P(return_value) = NULL;
48874888
Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0);
48884889

48894890
if (!Z_STRVAL_P(return_value)) {

ext/phar/tests/bug71354.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Phar: bug #71354: Heap corruption in tar/zip/phar parser.
3+
--SKIPIF--
4+
<?php if (!extension_loaded("phar")) die("skip"); ?>
5+
--FILE--
6+
<?php
7+
$p = new PharData(__DIR__."/bug71354.tar");
8+
var_dump($p['aaaa']->getContent());
9+
?>
10+
DONE
11+
--EXPECT--
12+
string(0) ""
13+
DONE

ext/phar/tests/bug71354.tar

1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)