Bug #79907 [Opn->Fbk]: exif_read_data() corrupt EXIF header: maximum directory nesting level reached

From: Date: Fri, 26 Feb 2021 12:19:12 +0000
Subject: Bug #79907 [Opn->Fbk]: 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-232396@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 Updated by: cmb@php.net Reported by: php at lho dot io Summary: exif_read_data() corrupt EXIF header: maximum directory nesting level reached -Status: Open +Status: Feedback Type: Bug Package: EXIF related Operating System: Linux PHP Version: 7.4.8 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Is this resolved as of PHP 7.3.23 and 7.4.11, respectively, or is there still an issue? Previous Comments: ------------------------------------------------------------------------ [2020-08-12 08:16:10] cmb@php.net > I suspect that is not what was intended. Probably not, see bug #31986, and also bug #28451; the fix for the latter introduced the constant with value 5[1]. [1] <http://git.php.net/?p=php-src.git;a=commit;h=ecb9f8668db5cc05734aa77b406028ca38ae2284> ------------------------------------------------------------------------ [2020-08-12 08:15:40] php at lho dot io I can confirm increasing the nesting limit works for my files. Is it possible for this limit to get raised upstream? I'm guessing that in the future more cameras are only going to add more metadata to the pictures and it'd great for user experience if it worked out of the box. ------------------------------------------------------------------------ [2020-08-12 08:13:40] nikic@php.net The following pull request has been associated: Patch Name: Make MAX_IFD_NESTING_LEVEL an actual nesting level On GitHub: https://github.com/php/php-src/pull/5976 Patch: https://github.com/php/php-src/pull/5976.patch ------------------------------------------------------------------------ [2020-08-12 08:01:39] nikic@php.net Looks like ifd_nesting_level only ever gets incremented, so MAX_IFD_NESTING_LEVEL is not really a "nesting level" but rather MAX_NUMBER_OF_IFD_TAGS. I suspect that is not what was intended. ------------------------------------------------------------------------ [2020-08-09 15:10:28] lookingdown at mail dot com 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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=79907 -- Edit this bug report at https://bugs.php.net/bug.php?id=79907&edit=1

« previous php.bugs (#232396) next »