check for good sizes in the byteorder swap function in the makernote code.
authorMarcus Meissner <marcus@jet.franken.de>
Wed, 26 Jul 2017 07:35:45 +0000 (09:35 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 26 Jul 2017 07:35:45 +0000 (09:35 +0200)
fixes
https://sourceforge.net/p/libexif/bugs/128/

libexif/canon/exif-mnote-data-canon.c
libexif/fuji/exif-mnote-data-fuji.c
libexif/olympus/exif-mnote-data-olympus.c
libexif/pentax/exif-mnote-data-pentax.c

index df3cb18..c523b9d 100644 (file)
@@ -99,6 +99,8 @@ exif_mnote_data_canon_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
        o_orig = n->order;
        n->order = o;
        for (i = 0; i < n->count; i++) {
+               if (n->entries[i].components && (n->entries[i].size/n->entries[i].components < exif_format_get_size (n->entries[i].format)))
+                       continue;
                n->entries[i].order = o;
                exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
                                n->entries[i].components, o_orig, o);
index c2365db..7e37464 100644 (file)
@@ -302,6 +302,8 @@ exif_mnote_data_fuji_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
        o_orig = n->order;
        n->order = o;
        for (i = 0; i < n->count; i++) {
+               if (n->entries[i].components && (n->entries[i].size/n->entries[i].components < exif_format_get_size (n->entries[i].format)))
+                       continue;
                n->entries[i].order = o;
                exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
                                n->entries[i].components, o_orig, o);
index a09c3c1..dac7f5b 100644 (file)
@@ -558,6 +558,8 @@ exif_mnote_data_olympus_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
        o_orig = n->order;
        n->order = o;
        for (i = 0; i < n->count; i++) {
+               if (n->entries[i].components && (n->entries[i].size/n->entries[i].components < exif_format_get_size (n->entries[i].format)))
+                       continue;
                n->entries[i].order = o;
                exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
                                n->entries[i].components, o_orig, o);
index a01c828..e6d47b0 100644 (file)
@@ -391,6 +391,8 @@ exif_mnote_data_pentax_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
        o_orig = n->order;
        n->order = o;
        for (i = 0; i < n->count; i++) {
+               if (n->entries[i].components && (n->entries[i].size/n->entries[i].components < exif_format_get_size (n->entries[i].format)))
+                       continue;
                n->entries[i].order = o;
                exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
                                n->entries[i].components, o_orig, o);