From: Operating system: gentoo linux amd64 PHP version: 5.3.6 Package: EXIF related Bug Type: Bug Bug description:Multiple TIFF SubIFDs are not handled correctly
Description: ------------ Tiff Tag SubIFD (330) ONLY works is there is a single SubIFD, but the Tiff specifications state that SubIFDs is an array of IFDs of size tag_count. If num_sub_ifd > 1, the tag long value is an offset to a sequence of longs, themselves representing the offsets of each SubIFD. In the source (ext/exif/exif.c) method exif_process_IFD_in_TIFF assumes that the tag long value always points to ONE SubIFD (lines 3693 and 3698). Effects: 1) If there is more than 1 SubIFD, the tiff parser will incorrectly be jumping around in the file, potentially printing TONS of warnings 2) exif_thumbnail() does NOT work for Nikon nef files Test script: --------------- Download the 2 nef files (nikon nefs are tiff files) below: http://nefarious.timotheegroleau.com/tests/dsc_2317.nef http://nefarious.timotheegroleau.com/tests/out.nef Run the following scripts from a php 5.3.6: php -r 'var_dump(exif_read_data("dsc_2317.nef"));' 2>&1 |less php -r 'var_dump(exif_read_data("out.nef"));' 2>&1 |less Notice the single warning for dsc_2317.nef, as the parser is quickly encountering an invalid entry, but notice also the ~39k warnings spat out for out.nef. Note: I recommend enabling EXIF_DEBUG for this, to see the offsets printed (note btw that there's a compilation error with EXIF_DEBUG on, which I've commented out for my tests) Expected result: ---------------- exif data returned, with no warnings when the input tiff file has multiple SubIFDs Actual result: -------------- exif data is returned, but based on the the input tiff, and where the SubIFD offset sends the parser, there can be *A LOT* of warnings being thrown. -- Edit bug report at https://bugs.php.net/bug.php?id=55420&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55420&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55420&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55420&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55420&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55420&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55420&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55420&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55420&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55420&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55420&r=support Expected behavior: https://bugs.php.net/fix.php?id=55420&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55420&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55420&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55420&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55420&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55420&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55420&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55420&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55420&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55420&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55420&r=mysqlcfg
