Bug #50660 [Com]: exif_read_data(): Illegal IFD offset (works fine with other exif readers)

From: Date: Fri, 05 Aug 2016 18:31:02 +0000
Subject: Bug #50660 [Com]: exif_read_data(): Illegal IFD offset (works fine with other exif readers)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202973@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50660&edit=1

 ID:                 50660
 Comment by:         support at imgsrc dot ru
 Reported by:        skinny dot bravo at gmail dot com
 Summary:            exif_read_data(): Illegal IFD offset (works fine
                     with other exif readers)
 Status:             Feedback
 Type:               Bug
 Package:            EXIF related
 Operating System:   Linux
 PHP Version:        5.*, 6
 Assigned To:        kalle
 Block user comment: N
 Private report:     N

 New Comment:

Can you please try 

http://o1.eu.is.pp.ru/v/vahmurka/3/16095163cDU.jpg
http://o1.eu.is.pp.ru/v/vahmurka/1/16095161rno.jpg


Previous Comments:
------------------------------------------------------------------------
[2016-08-05 06:13:26] kalle@php.net

Hi!

I know this is an old report, could you please reupload the images somewhere? For some reason my ISP
have blocked the domain and I do not have a way currently to obtain them from the outside.

thanks!

------------------------------------------------------------------------
[2011-01-31 07:36:37] mjk at emmjaykay dot org

The issue stems from exif.c's exif_process_IFD_in_JPEG() function where it calculates
NextDirOffset. If this means what I think it does, for EXIF_IFD and IFD_GPS, there is no next IFD
and no further parsing should take place. Right now, it parses into the string for the next entry
(2009...)

I am not sure if this is correct since I am no expert on EXIF.

The output of var_dump seems to be still in-correct, though. I do not know if this is a separate
issue or something I introduced with this patch.

------------------------------------------------------------------------
[2010-01-06 12:49:45] skinny dot bravo at gmail dot com

Sorry,

- php5.2-201001041530 produces the same result
+ php5.2-201001041530 produces the same result as 5.2.12 below

------------------------------------------------------------------------
[2010-01-06 12:42:40] iliaa@php.net

If it works with php5.2-201001041530 it means that the issue has been 
resolved.

------------------------------------------------------------------------
[2010-01-04 17:55:52] skinny dot bravo at gmail dot com

Description:
------------
PHP fails reading GPS data from a given set of photos from Samsung SGH-
i900. The images are said to come from the camera without any edits.

Ex: 

http://o1.imgsrc.ru/v/vahmurka/3/16095163cDU.jpg
http://o1.imgsrc.ru/v/vahmurka/1/16095161rno.jpg

exiftool 8.00 has no problem reading this file. php5.2-201001041530 
produces 
the same result.

Reproduce code:
---------------
# php -r 'var_dump(read_exif_data("16095163cDU.jpg",NULL,TRUE));'

Expected result:
----------------
...
["SectionsFound"]=>
    string(35) "ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS"
...
["GPS"]=>
  array(8) {
    ["GPSVersion"]=>
    string(4) ""
    ["GPSLatitudeRef"]=>
    string(1) "N"
    ["GPSLatitude"]=>
    array(3) {
      [0]=>
      string(4) "43/1"
      [1]=>
      string(4) "16/1"
      [2]=>
      string(11) "75363/10000"
    }
    ["GPSLongitudeRef"]=>
    string(1) "E"
    ["GPSLongitude"]=>
    array(3) {
      [0]=>
      string(4) "77/1"
      [1]=>
      string(4) "21/1"
      [2]=>
      string(11) "140249/2629"
    }
    ["GPSAltitudeRef"]=>
    string(1) ""
    ["GPSAltitude"]=>
    string(6) "1603/1"
    ["GPSMapDatum"]=>
    string(6) "WGS-84"
  }

these results are taken after fixing image with exiftool: 
# exiftool -all= -tagsfromfile @ -all:all -unsafe 16095163cDU.jpg


Actual result:
--------------
Warning: read_exif_data(16095163cDU.jpg): Illegal IFD offset in 
Command line code on line 1
array(4) {
  ["FILE"]=>
  array(6) {
    ["FileName"]=>
    string(15) "16095163cDU.jpg"
    ["FileDateTime"]=>
    int(1259257839)
    ["FileSize"]=>
    int(938692)
    ["FileType"]=>
    int(2)
    ["MimeType"]=>
    string(10) "image/jpeg"
    ["SectionsFound"]=>
    string(19) "ANY_TAG, IFD0, EXIF"
  }


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



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


Thread (18 messages)

« previous php.bugs (#202973) next »