]> granicus.if.org Git - php/commitdiff
Fix overrun in exif's "Illegal components" error message.
authorMitch Hagstrand <mhagstrand@gmail.com>
Thu, 5 Jan 2017 01:44:00 +0000 (17:44 -0800)
committerMitch Hagstrand <mhagstrand@gmail.com>
Thu, 5 Jan 2017 01:44:00 +0000 (17:44 -0800)
The variables "components" is an integer, but is being
output as long. As a result it is printing 8 bytes
instead of 4 bytes.

ext/exif/exif.c
ext/exif/tests/bug73737.phpt

index b5c99dd6c3b87210c6cea15799bc7efe3a02b4bf..3ff684282456bd70f44288eb20ac472d0eb017ca 100644 (file)
@@ -3230,7 +3230,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
        }
 
        if (components <= 0) {
-               exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%ld)", tag, exif_get_tagname(tag, tagname, -12, tag_table), components);
+               exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%d)", tag, exif_get_tagname(tag, tagname, -12, tag_table), components);
                return FALSE;
        }
 
index 00860651fccb6a01662f9444dc519e2a29e1c8b7..c61e8faf65e4cef0c841ea6b257d3feea5b3c213 100644 (file)
@@ -8,7 +8,7 @@ Bug #73737 (Crash when parsing a tag format)
        var_dump($exif);
 ?>
 --EXPECTF--
-Warning: exif_thumbnail(bug73737.tiff): Process tag(x0100=ImageWidth ): Illegal components(%i) in %s on line %d
+Warning: exif_thumbnail(bug73737.tiff): Process tag(x0100=ImageWidth ): Illegal components(0) in %s on line %d
 
 Warning: exif_thumbnail(bug73737.tiff): Error in TIFF: filesize(x0030) less than start of IFD dir(x10102) in %s line %d
 bool(false)