php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68113
Patch exif-fix revision 2014-09-29 00:00 UTC by stas@php.net

Patch exif-fix for EXIF related Bug #68113

Patch version 2014-09-29 00:00 UTC

Return to Bug #68113 | Download this patch
Patch Revisions:

Developer: stas@php.net

commit 3a9f03aed8efa69e13b6aa4abb1ce2d5f1a7e12c
Author: Stanislav Malyshev <stas@php.net>
Date:   Sun Sep 28 16:57:42 2014 -0700

    Fix bug #68113 (Heap corruption in exif_thumbnail())

diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 38907b4..637ebf9 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -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
index 0000000000000000000000000000000000000000..3ce7a620fb108a47d08d669552b995abbacea06a
GIT binary patch
literal 368
zcmex=<Nrg30N0AlGzJDwPb~&f1_p-z3=9e&3Iqfh7-WHL1_ovZDMlU!6(CC-h#8q!
U7#M-H1BlNEVT1UifItWU0A}kAcmMzZ

literal 0
HcmV?d00001

diff --git a/ext/exif/tests/bug68113.phpt b/ext/exif/tests/bug68113.phpt
new file mode 100644
index 0000000..0fa4c4a
--- /dev/null
+++ b/ext/exif/tests/bug68113.phpt
@@ -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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 12:01:27 2024 UTC