summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-10 16:15:00 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-10 16:15:00 +0200
commit3df043324e12fab985fc0a1ad4ff65b5f396ddb8 (patch)
tree8e8bfb81ff7b006dbda3d9b45150d4a515998b79
parent94c469ac982e4286972428f6ece16cf74cd95c94 (diff)
parente4aac082a2507ed3c51e4a73d0a22eb5d8273185 (diff)
downloadphp-git-3df043324e12fab985fc0a1ad4ff65b5f396ddb8.tar.gz
Merge branch 'PHP-7.4'
-rw-r--r--ext/phar/phar.c1
-rw-r--r--ext/phar/tests/bug77396.phpt14
2 files changed, 8 insertions, 7 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 93a0387366..90038d3e27 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1395,6 +1395,7 @@ int phar_create_or_parse_filename(char *fname, size_t fname_len, char *alias, si
mydata = ecalloc(1, sizeof(phar_archive_data));
mydata->fname = expand_filepath(fname, NULL);
if (mydata->fname == NULL) {
+ efree(mydata);
return FAILURE;
}
fname_len = strlen(mydata->fname);
diff --git a/ext/phar/tests/bug77396.phpt b/ext/phar/tests/bug77396.phpt
index ede25ff81f..7dc834aa45 100644
--- a/ext/phar/tests/bug77396.phpt
+++ b/ext/phar/tests/bug77396.phpt
@@ -5,11 +5,11 @@ Bug #77396 Relative filename exceeding maximum path length causes null pointer d
--FILE--
<?php
$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar';
-$phar = new PharData($path);
+try {
+ $phar = new PharData($path);
+} catch (UnexpectedValueException $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s%ebug77396.php:%d
-Stack trace:
-#0 %s%ebug77396.php(%d): PharData->__construct(%s)
-#1 {main}
- thrown in %s%ebug77396.php on line %d
+--EXPECT--
+Phar creation or opening failed