Skip to content

Fix GH-11020: spurious "Illegal IFD size" warning in exif_read_data()#22486

Open
eyupcanakman wants to merge 1 commit into
php:PHP-8.4from
eyupcanakman:fix/exif-illegal-ifd-size
Open

Fix GH-11020: spurious "Illegal IFD size" warning in exif_read_data()#22486
eyupcanakman wants to merge 1 commit into
php:PHP-8.4from
eyupcanakman:fix/exif-illegal-ifd-size

Conversation

@eyupcanakman

Copy link
Copy Markdown

exif_read_data() emits a spurious "Illegal IFD size" warning on valid JPEGs whose EXIF block ends right after the IFD entries, with no next-IFD offset following them. The bounds check added for bug #72094 treats that absent offset as an error. A missing offset means there is no further IFD, so the fix returns the parsed tags instead of warning. cmb69 diagnosed this on the issue. The out-of-bounds read the check guards stays intact, because those bytes are never read.

Adds a test, and confirms bug72094.phpt still rejects the malformed inputs.

When an IFD is not followed by a 4-byte next-IFD offset, the EXIF block has no further IFD.
Treat that as the end of the chain and return the parsed tags, instead of warning and discarding them.
The bounds check from bug #72094 still applies, so the absent offset bytes are never read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant