|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74428 exif_read_data(): "Illegal IFD size" warning occurs with correct exif format.
Submitted: 2017-04-13 06:47 UTC Modified: 2017-07-07 07:04 UTC
Avg. Score:4.0 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: bradpiccho at gmail dot com Assigned: kalle (profile)
Status: Closed Package: EXIF related
PHP Version: 5.6.30 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
33 + 14 = ?
Subscribe to this entry?

 [2017-04-13 06:47 UTC] bradpiccho at gmail dot com
EXIF data that doesn't have any IFD with offset to data value(i.e. all IFDs have  less than 4bytes data length values) and thumbnail data is not read correctly by exif_read_data().

sample image:

I think the problem is due to the incorrect comparison at line 3188 of ext/exif/exif.c.
it seems that the oerator must be ">" instead of ">=".

In the same way, I think the comparison at line 3160 must use ">" instead of ">=".

Test script:
    ini_set('display_errors', 'On');


exif.c.patch (last revision 2017-04-13 06:48 UTC by bradpiccho at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-25 19:05 UTC] me at sej dot de
I have this bug with PHP 7.0.15 also.

php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies

Warning: exif_read_data(IMG_8660_filt.JPG): IFD data bad offset: 0xFFFFFCF0 length 0x1042 in /httpdocs/devexif/test.php on line 6
array(34) { ["FileName"]=> string(17) "IMG_8660_filt.JPG" ["FileDateTime"]=> int(1493146490) ["FileSize"]=> int(865216) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(30) "ANY_TAG, IFD0, EXIF, MAKERNOTE" ["COMPUTED"]=> array(7) { ["html"]=> string(25) "width="1200" height="800"" ["Height"]=> int(800) ["Width"]=> int(1200) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) ["ApertureFNumber"]=> string(5) "f/5.6" ["Copyright"]=> string(13) "Andreas Knote" } ["Make"]=> string(5) "Canon" ["Model"]=> string(13) "Canon EOS 60D" ["Orientation"]=> int(1) ["XResolution"]=> string(5) "350/1" ["YResolution"]=> string(5) "350/1" ["ResolutionUnit"]=> int(2) ["Software"]=> string(26) "Digital Photo Professional" ["DateTime"]=> string(19) "2017:04:25 18:41:24" ["Artist"]=> string(13) "Andreas Knote" ["YCbCrPositioning"]=> int(1) ["Copyright"]=> string(13) "Andreas Knote" ["ExposureTime"]=> string(5) "1/500" ["FNumber"]=> string(5) "56/10" ["ExposureProgram"]=> int(4) ["ISOSpeedRatings"]=> int(125) ["UndefinedTag:0x8830"]=> int(2) ["UndefinedTag:0x8832"]=> int(125) ["ExifVersion"]=> string(4) "0230" ["DateTimeOriginal"]=> string(19) "2017:04:25 18:41:24" ["DateTimeDigitized"]=> string(19) "2017:04:25 18:41:24" ["ComponentsConfiguration"]=> string(4) "" ["ShutterSpeedValue"]=> string(12) "589824/65536" ["ApertureValue"]=> string(12) "327680/65536" ["ExposureBiasValue"]=> string(3) "1/3" ["MeteringMode"]=> int(5) ["Flash"]=> int(16) ["FocalLength"]=> string(5) "160/1" }
 [2017-07-07 07:04 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2017-07-07 08:20 UTC]
Automatic comment on behalf of kalle
Log: Fixed bug #74428 (exif_read_data(): &quot;Illegal IFD size&quot; warning occurs with correct exif format)
 [2017-07-07 08:20 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 02 12:05:53 2023 UTC