summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-05-13 16:42:23 -0700
committerStanislav Malyshev <stas@php.net>2014-05-13 16:43:10 -0700
commit9103c9eb4fccfa5f71283c0e631285252af95e5e (patch)
tree584256c4c67062706eacff4119595ba0498c5528
parent3e276d6728b95060352a507cf890a8bec60f3062 (diff)
parent3e9cb6a4a5504c888f185a5ab7d1cc02cc359cbe (diff)
downloadphp-git-9103c9eb4fccfa5f71283c0e631285252af95e5e.tar.gz
Merge branch 'bug67250' into PHP-5.4
* bug67250: Fix bug #67250 (iptcparse out-of-bounds read)
-rw-r--r--NEWS1
-rw-r--r--ext/standard/iptc.c3
-rw-r--r--ext/standard/tests/image/bug67250.phpt8
3 files changed, 12 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 03f8b87daf..6e2ff759ff 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ PHP NEWS
. Fixed bug #67245 (usage of memcpy() with overlapping src and dst in
zend_exceptions.c). (Bob)
. Fixed bug #67247 (spl_fixedarray_resize integer overflow). (Stas)
+ . Fixed bug #67250 (iptcparse out-of-bounds read). (Stas)
- Date:
. Fixed bug #67118 (DateTime constructor crash with invalid data). (Anatol)
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index 3257339106..ad4fa65029 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -329,6 +329,9 @@ PHP_FUNCTION(iptcparse)
recnum = buffer[ inx++ ];
if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */
+ if((inx+6) >= str_len) {
+ break;
+ }
len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) +
(((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ]));
inx += 6;
diff --git a/ext/standard/tests/image/bug67250.phpt b/ext/standard/tests/image/bug67250.phpt
new file mode 100644
index 0000000000..607de9f3b6
--- /dev/null
+++ b/ext/standard/tests/image/bug67250.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #67250 (iptcparse out-of-bounds read)
+--FILE--
+<?php
+var_dump(iptcparse("\x1C\x02_\x80___"));
+?>
+--EXPECT--
+bool(false)