php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75424 exif_read_data(image.jpg): corrupt EXIF header: maximum directory nesting
Submitted: 2017-10-24 11:10 UTC Modified: 2019-10-20 15:33 UTC
Votes:8
Avg. Score:4.0 ± 1.0
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:3 (37.5%)
From: Heikki dot Vesanto at gmail dot com Assigned: kalle (profile)
Status: No Feedback Package: EXIF related
PHP Version: 7.2.0RC4 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Heikki dot Vesanto at gmail dot com
New email:
PHP Version: OS:

 

 [2017-10-24 11:10 UTC] Heikki dot Vesanto at gmail dot com
Description:
------------
Sounds similar to: https://bugs.php.net/bug.php?id=66443

php -v
PHP 7.2.0RC4 (cli) (built: Oct 22 2017 13:39:08) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0-dev, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.2.0RC4, Copyright (c) 1999-2017, by Zend Technologies

Error I get:

PHP Warning:  exif_read_data(12_Adventure_Duck.jpg): corrupt EXIF header: maximum directory nesting level reached in /var/www/maps.gisforthought.com/html/getphotos.php on line 16

You can find the image at: https://maps.gisforthought.com/Photos/12_Adventure_Duck.jpg

I also have an image that does work on my setup:
https://maps.gisforthought.com/Photos/01_Adventure_Duck.jpg

EXIF as shown by the Linux exif terminal command:

EXIF tags in '12_Adventure_Duck.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
Manufacturer        |Panasonic
Model               |DMC-TZ40
X-Resolution        |180
Y-Resolution        |180
Resolution Unit     |Inch
Software            |Ver.1.2
Date and Time       |2014:05:26 05:42:32
Artist              |Picasa
YCbCr Positioning   |Co-sited
PRINT Image Matching|208 bytes undefined data
Compression         |JPEG compression
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Exposure Time       |1/800 sec.
F-Number            |f/3.3
Exposure Program    |Normal program
ISO Speed Ratings   |100
Exif Version        |Exif Version 2.3
Date and Time (Origi|2014:05:26 05:42:32
Date and Time (Digit|2014:05:26 05:42:32
Components Configura|Y Cb Cr -
Compressed Bits per | 4
Exposure Bias       |0.00 EV
Maximum Aperture Val|3.45 EV (f/3.3)
Metering Mode       |Center-weighted average
Light Source        |Unknown
Flash               |Flash did not fire, compulsory flash mode
Focal Length        |4.3 mm
Maker Note          |3596 bytes undefined data
FlashPixVersion     |FlashPix Version 1.0
Color Space         |sRGB
Pixel X Dimension   |1131
Pixel Y Dimension   |848
Sensing Method      |One-chip color area sensor
File Source         |DSC
Scene Type          |Directly photographed
Custom Rendered     |Normal process
Exposure Mode       |Auto exposure
White Balance       |Auto white balance
Digital Zoom Ratio  |0.0
Focal Length in 35mm|24
Scene Capture Type  |Standard
Gain Control        |Normal
Contrast            |Normal
Saturation          |Normal
Sharpness           |Normal
Image Unique ID     |1b5003f64a45bef4946ef7a95f8d18a6
GPS Tag Version     |2.2.0.0
North or South Latit|N
Latitude            |40, 27, 15.812
East or West Longitu|E
Longitude           |116, 32, 10.7166
Altitude Reference  |Sea level
Altitude            |971.380
GPS Time (Atomic Clo|04:42:32.00
GPS Receiver Status |V
GPS Measurement Mode|2
Measurement Precisio|0.0
GPS Image Direction |M
GPS Image Direction |135
Geodetic Survey Data|WGS-84
Name of GPS Processi|14 bytes undefined data
Name of GPS Area    |266 bytes undefined data
GPS Date            |2014:05:26
Interoperability Ind|R98
Interoperability Ver|0100
RelatedImageWidth   |4896
RelatedImageLength  |3672
--------------------+----------------------------------------------------------
EXIF data contains a thumbnail (5865 bytes).

Test script:
---------------
<?php
    $dir = "Photos";

    $files = scandir($dir);
    
    foreach($files as $file) {
				$path = $dir . "/" . $file;
				$exif = exif_read_data($path);
                }
?>

Actual result:
--------------
PHP Warning:  exif_read_data(12_Adventure_Duck.jpg): corrupt EXIF header: maximum directory nesting level reached in /var/www/maps.gisforthought.com/html/getphotos.php on line 16

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 11:51 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2017-10-24 11:51 UTC] kalle@php.net
Thank you for the report, I will try take a look shortly at this and see if I can get this resolved :)
 [2017-10-29 15:26 UTC] kalle@php.net
-Status: Assigned +Status: Feedback
 [2017-10-29 15:26 UTC] kalle@php.net
Hi Heikki, I tried to test both images with the latest master and PHP 7.2, and there are no differences nor have there been any changes to the EXIF extension since around the time of 7.2.0 Beta 1.

Both images parses perfectly fine and extracts the EXIF data for me
 [2017-11-12 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2018-03-16 09:19 UTC] roman dot kucera at gmail dot com
same problem 
Warning: exif_read_data(01546_02_00.jpg): corrupt EXIF header: maximum directory nesting level reached

with camera Canon 760D
PHP Version 7.0.5 and every earlier version
 [2018-03-17 12:49 UTC] roman dot kucera at gmail dot com
In PHP Version 7.2.3 it is ok.
 [2018-11-29 13:00 UTC] gen dot work at gmail dot com
Same here.

PHP Version:

PHP 7.2.12 (cli) (built: Nov  6 2018 10:48:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.12, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans


Error:

$ php -r 'exif_read_data("bad-exif.jpg");'

PHP Warning:  exif_read_data(lc-bad-exif.jpg): corrupt EXIF header: maximum directory nesting level reached in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. exif_read_data() Command line code:1

Warning: exif_read_data(lc-bad-exif.jpg): corrupt EXIF header: maximum directory nesting level reached in Command line code on line 1

Call Stack:
    0.0003     397952   1. {main}() Command line code:0
    0.0003     397952   2. exif_read_data() Command line code:1
 [2018-11-29 13:12 UTC] gen dot work at gmail dot com
print_r($exif) gives this array: https://gist.github.com/rybakit/a33b6262dfab412678f8a9559cd8ce15#file-exif_read_data-log
 [2018-11-29 16:59 UTC] requinix@php.net
@gen: Please create a new bug report, making sure to upload the problematic image somewhere we can get it.
 [2019-10-02 07:35 UTC] christian dot ruhstaller at goldinteractive dot ch
This issue still exists in PHP 7.3 and can be reproduced with the linked image:

https://maps.gisforthought.com/Photos/12_Adventure_Duck.jpg

php --version
PHP 7.3.3 (cli) (built: Mar  9 2019 00:41:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
 [2019-10-20 15:33 UTC] cmb@php.net
> This issue still exists in PHP 7.3 […]

How would you know, if you're running an old version?

> PHP 7.3.3 (cli) (built: Mar  9 2019 00:41:46) ( NTS )
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 20:01:30 2024 UTC