summaryrefslogtreecommitdiffstats
path: root/bug70433.patch
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-09-30 16:18:02 +0200
committerRemi Collet <fedora@famillecollet.com>2015-09-30 16:18:02 +0200
commit18c59487150c2cb3d7f1292086398a78aa7905da (patch)
tree25874e5b5794c4264ab609b6a230c3d5c917dbe3 /bug70433.patch
parent24c490cfb50b4fac731ed7624229c332b11e0bcb (diff)
PHP 5.4: backport fix for #70433 and #69720
Diffstat (limited to 'bug70433.patch')
-rw-r--r--bug70433.patch52
1 files changed, 52 insertions, 0 deletions
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 <stas@php.net>
+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 <stas@php.net>
+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
+