]> granicus.if.org Git - php/commitdiff
Fix bug #68113 (Heap corruption in exif_thumbnail())
authorStanislav Malyshev <stas@php.net>
Sun, 28 Sep 2014 23:57:42 +0000 (16:57 -0700)
committerStanislav Malyshev <stas@php.net>
Tue, 14 Oct 2014 06:17:45 +0000 (23:17 -0700)
NEWS
ext/exif/exif.c
ext/exif/tests/bug68113.jpg [new file with mode: 0755]
ext/exif/tests/bug68113.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index b074f9f3cb07cc38a2e1c201f702bcbdff113f35..35193d1441b25b5cde511d0f49a365dcde294dc1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-?? ??? 2014, PHP 5.4.34
+16 Oct 2014, PHP 5.4.34
 
 - Fileinfo:
   . Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
@@ -14,6 +14,10 @@ PHP                                                                        NEWS
 - cURL:
   . Fixed bug #68089 (NULL byte injection - cURL lib). (Stas)
 
+- EXIF:
+  . Fixed bug #68113 (Heap corruption in exif_thumbnail()). (CVE-2014-3670)
+    (Stas)
+
 - OpenSSL:
   . Reverted fixes for bug #41631, due to regressions. (Stas) 
 
index 38907b4d942a8d2419060a688aa3c5e5dedcb118..637ebf9289b40d157fdf8edcdddeb3d907b28d9b 100644 (file)
@@ -2426,11 +2426,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
                                        data_ptr += 8;
                                        break;
                                case TAG_FMT_SINGLE:
-                                       memmove(data_ptr, &info_data->value.f, byte_count);
+                                       memmove(data_ptr, &info_value->f, 4);
                                        data_ptr += 4;
                                        break;
                                case TAG_FMT_DOUBLE:
-                                       memmove(data_ptr, &info_data->value.d, byte_count);
+                                       memmove(data_ptr, &info_value->d, 8);
                                        data_ptr += 8;
                                        break;
                        }
diff --git a/ext/exif/tests/bug68113.jpg b/ext/exif/tests/bug68113.jpg
new file mode 100755 (executable)
index 0000000..3ce7a62
Binary files /dev/null and b/ext/exif/tests/bug68113.jpg differ
diff --git a/ext/exif/tests/bug68113.phpt b/ext/exif/tests/bug68113.phpt
new file mode 100644 (file)
index 0000000..0fa4c4a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #68113 (Heap corruption in exif_thumbnail())
+--SKIPIF--
+<?php
+extension_loaded("exif") or die("skip need exif");
+?>
+--FILE--
+<?php
+var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
+?>
+Done
+--EXPECTF--
+Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
+
+Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
+bool(false)
+Done
\ No newline at end of file