Bug #72682 [NEW]: exif_read_data() fails to read all data for some images

From: Date: Tue, 26 Jul 2016 17:50:52 +0000
Subject: Bug #72682 [NEW]: exif_read_data() fails to read all data for some images
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202614@lists.php.net to get a copy of this message
From: r dot helm at helm-software dot de Operating system: PHP version: 7.0.9 Package: EXIF related Bug Type: Bug Bug description:exif_read_data() fails to read all data for some images Description: ------------ Since version 7.0.9 exif_read_data() fails to read out all the tags and sections for some images, e.g. images shot with a DJI drone. Example image: http://hs12.de/exif/image.jpg The expected result comes from running the script with php version 7.0.8. The actual result comes from 7.0.9. This was most likely caused by one of the exif changes in 7.0.9: #72603 Out of bound read in exif_process_IFD_in_MAKERNOTE #72618 NULL Pointer Dereference in exif_process_user_comment So it probably has to do with the makernote or usercomment tags that are in these images. Test script: --------------- <?php $exif = exif_read_data("image.jpg", null, true); var_dump($exif); Expected result: ---------------- array(8) { ["FILE"]=> array(6) { ["FileName"]=> string(9) "image.jpg" ["FileDateTime"]=> int(1469549406) ["FileSize"]=> int(5199843) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(51) "ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP, WINXP" } ["COMPUTED"]=> array(8) { ["html"]=> string(26) "width="4000" height="3000"" ["Height"]=> int(3000) ["Width"]=> int(4000) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) ["ApertureFNumber"]=> string(5) "f/2.8" ["Thumbnail.FileType"]=> int(2) ["Thumbnail.MimeType"]=> string(10) "image/jpeg" } ["IFD0"]=> array(14) { ["ImageDescription"]=> string(26) "DCIM\100MEDIA\DJI_0413.JPG" ["Make"]=> string(3) "DJI" ["Model"]=> string(6) "FC300X" ["Orientation"]=> int(1) ["XResolution"]=> string(4) "72/1" ["YResolution"]=> string(4) "72/1" ["ResolutionUnit"]=> int(2) ["Software"]=> string(11) "v01.30.5036" ["DateTime"]=> string(19) "2016:07:26 11:32:59" ["YCbCrPositioning"]=> int(1) ["Exif_IFD_Pointer"]=> int(182) ["GPS_IFD_Pointer"]=> int(686) ["Comments"]=> string(128) "0�.�9�.�1�3�8�������������������������������������������������������������������������������������������������������������������" ["Keywords"]=> string(16) "N���������������" } ["THUMBNAIL"]=> array(6) { ["Compression"]=> int(6) ["XResolution"]=> string(4) "72/1" ["YResolution"]=> string(4) "72/1" ["ResolutionUnit"]=> int(2) ["JPEGInterchangeFormat"]=> int(41972) ["JPEGInterchangeFormatLength"]=> int(8065) } ["EXIF"]=> array(39) { ["ExposureTime"]=> string(12) "1206/1000000" ["FNumber"]=> string(7) "280/100" ["ExposureProgram"]=> int(2) ["ISOSpeedRatings"]=> int(100) ["ExifVersion"]=> string(4) "0230" ["DateTimeOriginal"]=> string(19) "2016:07:26 11:32:59" ["DateTimeDigitized"]=> string(19) "2016:07:26 11:32:59" ["ComponentsConfiguration"]=> string(4) "�" ["CompressedBitsPerPixel"]=> string(15) "4861324/1500000" ["ShutterSpeedValue"]=> string(11) "-9695/-1000" ["ApertureValue"]=> string(7) "200/100" ["ExposureBiasValue"]=> string(6) "-11/32" ["MaxApertureValue"]=> string(7) "200/100" ["SubjectDistance"]=> string(5) "0/100" ["MeteringMode"]=> int(2) ["LightSource"]=> int(1) ["Flash"]=> int(32) ["FocalLength"]=> string(7) "361/100" ["MakerNote"]=> string(256) " ������DJI���������� ������̽� ������L�� ��������� ����ff��� ������� ����33� � �����̳� � ����f�� � ����������������������������������������������������������������������������������������������������������������������������������" ["FlashPixVersion"]=> string(4) "0010" ["ColorSpace"]=> int(1) ["ExifImageWidth"]=> int(4000) ["ExifImageLength"]=> int(3000) ["InteroperabilityOffset"]=> int(656) ["ExposureIndex"]=> string(3) "0/0" ["FileSource"]=> string(1) "" ["SceneType"]=> string(1) "�" ["CustomRendered"]=> int(0) ["ExposureMode"]=> int(0) ["WhiteBalance"]=> int(0) ["DigitalZoomRatio"]=> string(3) "0/0" ["FocalLengthIn35mmFilm"]=> int(20) ["SceneCaptureType"]=> int(0) ["GainControl"]=> int(0) ["Contrast"]=> int(0) ["Saturation"]=> int(0) ["Sharpness"]=> int(0) ["DeviceSettingDescription"]=> string(4) "����" ["SubjectDistanceRange"]=> int(0) } ["GPS"]=> array(7) { ["GPSVersion"]=> string(4) "��" ["GPSLatitudeRef"]=> string(1) "N" ["GPSLatitude"]=> array(3) { [0]=> string(4) "50/1" [1]=> string(3) "1/1" [2]=> string(12) "185831/10000" } ["GPSLongitudeRef"]=> string(1) "E" ["GPSLongitude"]=> array(3) { [0]=> string(4) "10/1" [1]=> string(3) "9/1" [2]=> string(12) "435465/10000" } ["GPSAltitudeRef"]=> string(1) "�" ["GPSAltitude"]=> string(11) "177330/1000" } ["INTEROP"]=> array(2) { ["InterOperabilityIndex"]=> string(3) "R98" ["InterOperabilityVersion"]=> string(4) "0100" } ["WINXP"]=> array(2) { ["Comments"]=> string(1) "0" ["Keywords"]=> string(1) "N" } } Actual result: -------------- array(4) { ["FILE"]=> array(6) { ["FileName"]=> string(9) "image.jpg" ["FileDateTime"]=> int(1469549406) ["FileSize"]=> int(5199843) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(19) "ANY_TAG, IFD0, EXIF" } ["COMPUTED"]=> array(6) { ["html"]=> string(26) "width="4000" height="3000"" ["Height"]=> int(3000) ["Width"]=> int(4000) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) ["ApertureFNumber"]=> string(5) "f/2.8" } ["IFD0"]=> array(10) { ["ImageDescription"]=> string(26) "DCIM\100MEDIA\DJI_0413.JPG" ["Make"]=> string(3) "DJI" ["Model"]=> string(6) "FC300X" ["Orientation"]=> int(1) ["XResolution"]=> string(4) "72/1" ["YResolution"]=> string(4) "72/1" ["ResolutionUnit"]=> int(2) ["Software"]=> string(11) "v01.30.5036" ["DateTime"]=> string(19) "2016:07:26 11:32:59" ["YCbCrPositioning"]=> int(1) } ["EXIF"]=> array(18) { ["ExposureTime"]=> string(12) "1206/1000000" ["FNumber"]=> string(7) "280/100" ["ExposureProgram"]=> int(2) ["ISOSpeedRatings"]=> int(100) ["ExifVersion"]=> string(4) "0230" ["DateTimeOriginal"]=> string(19) "2016:07:26 11:32:59" ["DateTimeDigitized"]=> string(19) "2016:07:26 11:32:59" ["ComponentsConfiguration"]=> string(4) "�" ["CompressedBitsPerPixel"]=> string(15) "4861324/1500000" ["ShutterSpeedValue"]=> string(11) "-9695/-1000" ["ApertureValue"]=> string(7) "200/100" ["ExposureBiasValue"]=> string(6) "-11/32" ["MaxApertureValue"]=> string(7) "200/100" ["SubjectDistance"]=> string(5) "0/100" ["MeteringMode"]=> int(2) ["LightSource"]=> int(1) ["Flash"]=> int(32) ["FocalLength"]=> string(7) "361/100" } } -- Edit bug report at https://bugs.php.net/bug.php?id=72682&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72682&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72682&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72682&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72682&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72682&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72682&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72682&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72682&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72682&r=support Expected behavior: https://bugs.php.net/fix.php?id=72682&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72682&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72682&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72682&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72682&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72682&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72682&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72682&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72682&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72682&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72682&r=mysqlcfg

« previous php.bugs (#202614) next »