From b5fcfe18f4462c30cbd7572e3f0e79201600e40f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 30 Sep 2015 16:18:02 +0200 Subject: PHP 5.4: backport fix for #70433 and #69720 --- bug70433.patch | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 bug70433.patch (limited to 'bug70433.patch') diff --git a/bug70433.patch b/bug70433.patch new file mode 100644 index 0000000..d4a4335 --- /dev/null +++ b/bug70433.patch @@ -0,0 +1,52 @@ +Backported from 5.5 for 5.4 +binary patch dropped + + +From e78ac461dbefb7c4a3e9fde78d50fbc56b7b0183 Mon Sep 17 00:00:00 2001 +From: Stanislav Malyshev +Date: Mon, 28 Sep 2015 17:12:35 -0700 +Subject: [PATCH] FIx bug #70433 - Uninitialized pointer in phar_make_dirstream + when zip entry filename is "/" + +From 1ddf72180a52d247db88ea42a3e35f824a8fbda1 Mon Sep 17 00:00:00 2001 +From: Stanislav Malyshev +Date: Mon, 28 Sep 2015 21:37:26 -0700 +Subject: [PATCH] Better fix for bug #70433 + +--- + ext/phar/dirstream.c | 2 +- + ext/phar/util.c | 2 +- + ext/phar/zip.c | 4 +++- + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/ext/phar/util.c b/ext/phar/util.c +index e7decda..303daed 100644 +--- a/ext/phar/util.c ++++ b/ext/phar/util.c +@@ -2248,7 +2248,7 @@ void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename + + while ((s = zend_memrchr(filename, '/', filename_len))) { + filename_len = s - filename; +- if (FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) { ++ if (!filename_len || FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) { + break; + } + } +diff --git a/ext/phar/zip.c b/ext/phar/zip.c +index 142165c..e4883d3 100644 +--- a/ext/phar/zip.c ++++ b/ext/phar/zip.c +@@ -396,7 +396,9 @@ foundit: + + if (entry.filename[entry.filename_len - 1] == '/') { + entry.is_dir = 1; +- entry.filename_len--; ++ if(entry.filename_len > 1) { ++ entry.filename_len--; ++ } + entry.flags |= PHAR_ENT_PERM_DEF_DIR; + } else { + entry.is_dir = 0; +-- +2.1.4 + -- cgit