com php-src: Fix bug #67250 (iptcparse out-of-bounds read): NEWS ext/standard/iptc.c ext/standard/tests/image/bug67250.phpt
| From: | Stanislav Malyshev | Date: | Mon, 12 May 2014 02:09:19 +0000 |
| Subject: | com php-src: Fix bug #67250 (iptcparse out-of-bounds read): NEWS ext/standard/iptc.c ext/standard/tests/image/bug67250.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78323@lists.php.net to get a copy of this message | ||
Commit: 3e9cb6a4a5504c888f185a5ab7d1cc02cc359cbe
Author: Stanislav Malyshev <stas@php.net> Sun, 11 May 2014 19:09:19 -0700
Parents: 2b475eebbea85779989e98e87753d6b023a1d131
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3e9cb6a4a5504c888f185a5ab7d1cc02cc359cbe
Log:
Fix bug #67250 (iptcparse out-of-bounds read)
Bugs:
https://bugs.php.net/67250
Changed paths:
M NEWS
M ext/standard/iptc.c
A ext/standard/tests/image/bug67250.phpt
Diff:
diff --git a/NEWS b/NEWS
index 03f8b87..6e2ff75 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 3257339..d2c14c9 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 0000000..607de9f
--- /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)