This patch changes processing a little and causes some crafted tags to not be parsed and generate a warning.
This is a slight BC break from earlier versions, since it will no longer return the tags of that it was mismatching (see bug68799.phpt), namely the "WINXP" section and the "Author" tag is no longer returned due to this. Although this BC break is merely only for crafted tags, this can also have some real life effects on pictures re-saved from editors that can cause bad exif data writes, so lets keep it here.
Samsung, DJI & Panasonic. (Kalle)
. Fixed bug #72682 (exif_read_data() fails to read all data for some
images). (Kalle)
+ . Fixed bug #68547 (Exif Header component value check error).
+ (sjh21a at gmail dot com, Kalle)
. Fixed bug #66443 (Corrupt EXIF header: maximum directory nesting level
reached for some cameras). (Kalle)
. Fixed Redhat bug #1362571 (PHP not returning full results for
/*return TRUE;*/
}
- if (components < 0) {
+ 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);
return FALSE;
}
--- /dev/null
+--TEST--
+Bug #68547 (Exif Header component value check error)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'bug68547.jpg');
+?>
+===DONE===
+--EXPECTF--
+Warning: exif_read_data(bug68547.jpg): Process tag(x9C9E=Keywords ): Illegal components(0) in %sbug68547.php on line %d
+===DONE===
\ No newline at end of file
?>
--EXPECTF--
+Warning: exif_read_data(bug68799.jpg): Process tag(x9C9D=Author ): Illegal components(0) in %s on line %d
Array
(
[FileName] => bug68799.jpg
[FileSize] => 735
[FileType] => 2
[MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, WINXP
+ [SectionsFound] => ANY_TAG, IFD0
[COMPUTED] => Array
(
[html] => width="1" height="1"
[XResolution] => 96/1
[YResolution] => 96/1
[ResolutionUnit] => 2
- [Author] =>
)
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
-Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s%ebug72094.php on line %d
+Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %sbug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s%ebug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
-Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s%ebug72094.php on line %d
+Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal components(0) in %s%ebug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s%ebug72094.php on line %d