Bug #74428 [Asn->Csd]: exif_read_data(): "Illegal IFD size" warning occurs with correct exif format.

From: Date: Fri, 07 Jul 2017 08:20:24 +0000
Subject: Bug #74428 [Asn->Csd]: exif_read_data(): "Illegal IFD size" warning occurs with correct exif format.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209883@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74428&edit=1

 ID:                 74428
 Updated by:         kalle@php.net
 Reported by:        bradpiccho at gmail dot com
 Summary:            exif_read_data(): "Illegal IFD size" warning occurs
                     with correct exif format.
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            EXIF related
 Operating System:   Any
 PHP Version:        5.6.30
 Assigned To:        kalle
 Block user comment: N
 Private report:     N

 New Comment:

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(): "Illegal IFD size" warning occurs with
correct exif format)


Previous Comments:
------------------------------------------------------------------------
[2017-04-25 19:05:08] 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" ["Exposur!
 eProgram"]=> 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-04-13 06:47:24] 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');
?>




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74428&edit=1


Thread (4 messages)

« previous php.bugs (#209883) next »