From: Mitch Hagstrand Date: Thu, 5 Jan 2017 01:44:00 +0000 (-0800) Subject: Fix overrun in exif's "Illegal components" error message. X-Git-Tag: php-7.2.0alpha1~642^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54404808abe870ffbc1be78cd3783254a18e8170;p=php Fix overrun in exif's "Illegal components" error message. The variables "components" is an integer, but is being output as long. As a result it is printing 8 bytes instead of 4 bytes. --- diff --git a/ext/exif/exif.c b/ext/exif/exif.c index b5c99dd6c3..3ff6842824 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -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; } diff --git a/ext/exif/tests/bug73737.phpt b/ext/exif/tests/bug73737.phpt index 00860651fc..c61e8faf65 100644 --- a/ext/exif/tests/bug73737.phpt +++ b/ext/exif/tests/bug73737.phpt @@ -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)