summaryrefslogtreecommitdiffstats
path: root/bug71498.patch
diff options
context:
space:
mode:
Diffstat (limited to 'bug71498.patch')
-rw-r--r--bug71498.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/bug71498.patch b/bug71498.patch
new file mode 100644
index 0000000..d4977e7
--- /dev/null
+++ b/bug71498.patch
@@ -0,0 +1,31 @@
+Backported from 5.5 for 5.4 by Remi Collet
+binary patch dropped
+
+From a6fdc5bb27b20d889de0cd29318b3968aabb57bd Mon Sep 17 00:00:00 2001
+From: Stanislav Malyshev <stas@php.net>
+Date: Sun, 21 Feb 2016 16:51:05 -0800
+Subject: [PATCH] Fix bug #71498: Out-of-Bound Read in phar_parse_zipfile()
+
+---
+ ext/phar/tests/bug71488.phpt | 1 +
+ ext/phar/tests/bug71498.phpt | 17 +++++++++++++++++
+ ext/phar/tests/bug71498.zip | Bin 0 -> 65677 bytes
+ ext/phar/zip.c | 6 +++---
+ 4 files changed, 21 insertions(+), 3 deletions(-)
+ create mode 100644 ext/phar/tests/bug71498.phpt
+ create mode 100644 ext/phar/tests/bug71498.zip
+
+diff --git a/ext/phar/zip.c b/ext/phar/zip.c
+index e4883d3..7f294c2 100644
+--- a/ext/phar/zip.c
++++ b/ext/phar/zip.c
+@@ -199,7 +199,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
+ }
+
+ while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) {
+- if (!memcmp(p + 1, "K\5\6", 3)) {
++ if ((p - buf) + sizeof(locator) <= size && !memcmp(p + 1, "K\5\6", 3)) {
+ memcpy((void *)&locator, (void *) p, sizeof(locator));
+ if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
+ /* split archives not handled */
+