Bug #79907 [Com]: exif_read_data() corrupt EXIF header: maximum directory nesting level reached
| From: | lookingdown at mail dot com | Date: | Sun, 09 Aug 2020 15:10:28 +0000 |
| Subject: | Bug #79907 [Com]: exif_read_data() corrupt EXIF header: maximum directory nesting level reached | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228470@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79907&edit=1
ID: 79907
Comment by: lookingdown at mail dot com
Reported by: php at lho dot io
Summary: exif_read_data() corrupt EXIF header: maximum
directory nesting level reached
Status: Open
Type: Bug
Package: EXIF related
Operating System: Linux
PHP Version: 7.4.8
Block user comment: N
Private report: N
New Comment:
ext/exif/exif.c
line 69
#define MAX_IFD_NESTING_LEVEL 150
changing this to
#define MAX_IFD_NESTING_LEVEL 300
Should cover most EXIF value scenarios, f.ex. Panasonic GH4 with added GPS info have 244 entries.
After value change of MAX_IFD_NESTING_LEVEL to desired value f.ex. 300 in exif.c recompile module
and replace exif.so in extension dir of PHP installation.
Tested with 7.3 from github src repo. Seems to do the trick, the problem have nothing to do with
inherent limitations of PHP as suggested elsewhere, just this restriction/limitation hardcoded in
extension exif.
Previous Comments:
------------------------------------------------------------------------
[2020-07-28 12:29:13] php at lho dot io
Description:
------------
Might be the same problem as in https://bugs.php.net/bug.php?id=78083, I'm no
EXIF expert. In that case, let the reference photo be another datapoint.
When reading exif data from an image (which works fine in exiftool), I get the error:
PHP Warning: exif_read_data(DSCF1362.jpg): corrupt EXIF header: maximum directory nesting level
reached in /home/leo/Downloads/test/script.php on line 2
Geodata is missing in the result.
Most images taken with the same camera (Fuji X-T30) and edited with darktable work, but I have 8
images where this error happens. Upon request, I can provide additional images. Link to the image
causing this specific error: https://gofile.io/d/A42LUr
Test script:
---------------
<?php
$exif = exif_read_data('DSCF1362.jpg', 0, true);
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: ";
print_r($val);
echo "<br />\n";
}
}
?>
Expected result:
----------------
Should read all EXIF data correctly
Actual result:
--------------
Error message and missing data
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79907&edit=1