php.net |  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
Votes:6
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bradpiccho at gmail dot com
New email:
PHP Version: OS:

 

 [2017-04-13 06:47 UTC] bradpiccho at gmail dot com
Description:
------------
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:
https://gist.githubusercontent.com/yoshitaka-sato/c5b6816231f675806417b1cf2793134e/raw/0a609217ee557c030a79dd09f71700564e30363e/exif_sample.jpg

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:
---------------
<?php
    ini_set('display_errors', 'On');
    exif_read_data('./exif_sample.jpg');
?>



Patches

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

Pull Requests

History

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] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2017-07-07 08:20 UTC] kalle@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=php-src.git;a=commit;h=900ce92c9af9ad8616a4a698e5ffd2a957c1f547
Log: Fixed bug #74428 (exif_read_data(): &quot;Illegal IFD size&quot; warning occurs with correct exif format)
 [2017-07-07 08:20 UTC] kalle@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC