com php-src: Changed the way MAKERNOTE is handled in case we do not have a matching signature (Remi).: ext/exif/exif.c
| From: | Anatol Belski | Date: | Wed, 03 Aug 2016 15:36:00 +0000 |
| Subject: | com php-src: Changed the way MAKERNOTE is handled in case we do not have a matching signature (Remi).: ext/exif/exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93575@lists.php.net to get a copy of this message | ||
Commit: d5796fb298abb2a3e389818ad924589fa35e58b9
Author: Kalle Sommer Nielsen <kalle@php.net> Wed, 3 Aug 2016 17:05:31 +0200
Committer: Anatol Belski <ab@php.net> Wed, 3 Aug 2016 17:36:00 +0200
Parents: 67c2b0a9e8c746fca5bd0ef17e8d184c4f201020
Branches: PHP-5.6 PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d5796fb298abb2a3e389818ad924589fa35e58b9
Log:
Changed the way MAKERNOTE is handled in case we do not have a matching signature (Remi).
Before this patch, exif_process_IFD_in_MAKERNOTE() would return false, then causing the rest of the
EXIF parsing to be interrupted. This is a regression from earlier which was most likely a part of a
security fix for MAKERNOTE.
The new behavior is to instead of stopping to parse, to continue so we can still fetch data like
thumbnail and GPS, thrus allowing yet unsupported formats to parse. If EXIF's debugging mode is
enabled, a notice will display in case we do not match against a valid MAKERNOTE signature..
This should temporarily fix bug #72682 (exif_read_data() fails to read all data for some images)
until I get around to debug it further.
(cherry picked from commit aabcb5481d9e717df77192dab2894468b9fc63b4)
Bugs:
https://bugs.php.net/72682
Changed paths:
M ext/exif/exif.c
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 5564de4..94652e9 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -1708,6 +1708,10 @@ static void exif_iif_add_value(image_info_type *image_info, int
section_index, c
if (!length)
break;
case TAG_FMT_UNDEFINED:
+ if (tag == TAG_MAKER_NOTE) {
+ length = MIN(length, strlen(value));
+ }
+
if (value) {
/* do not recompute length here */
info_value->s = estrndup(value, length);
@@ -2723,8 +2727,14 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char *
valu
char *dir_start;
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
- if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
- return FALSE;
+ if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
+#ifdef EXIF_DEBUG
+ exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "No maker note data found. Detected
maker: %s (length = %d)", ImageInfo->make, strlen(ImageInfo->make));
+#endif
+ /* unknown manufacturer, not an error, use it as a string */
+ return TRUE;
+ }
+
maker_note = maker_note_array+i;
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)",
maker_note->make?maker_note->make:"",
maker_note->model?maker_note->model:"");*/