From d4b67896ecb248796a0493a9d6205b22c7dff4e2 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 11 May 2014 19:09:19 -0700 Subject: [PATCH] Fix bug #67250 (iptcparse out-of-bounds read) --- ext/standard/iptc.c | 3 +++ ext/standard/tests/image/bug67250.phpt | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 ext/standard/tests/image/bug67250.phpt diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 420111e731..e3190d5633 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 0000000000..607de9f3b6 --- /dev/null +++ b/ext/standard/tests/image/bug67250.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #67250 (iptcparse out-of-bounds read) +--FILE-- + +--EXPECT-- +bool(false) -- 2.40.0