com php-src: Fix bug #67250 (iptcparse out-of-bounds read): ext/standard/iptc.c ext/standard/tests/image/bug67250.phpt
| From: | Johannes Schlüter | Date: | Fri, 18 Jul 2014 23:02:52 +0000 |
| Subject: | com php-src: Fix bug #67250 (iptcparse out-of-bounds read): ext/standard/iptc.c ext/standard/tests/image/bug67250.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79635@lists.php.net to get a copy of this message | ||
Commit: d4b67896ecb248796a0493a9d6205b22c7dff4e2
Author: Stanislav Malyshev <stas@php.net> Sun, 11 May 2014 19:09:19 -0700
Parents: 84605098bc81517919ecb43935682fdd8a249f9d
Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d4b67896ecb248796a0493a9d6205b22c7dff4e2
Log:
Fix bug #67250 (iptcparse out-of-bounds read)
Bugs:
https://bugs.php.net/67250
Changed paths:
M ext/standard/iptc.c
A ext/standard/tests/image/bug67250.phpt
Diff:
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index 420111e..e3190d5 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -335,6 +335,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)