Update vendored TinyEXIF to 8c22aff - #92
Conversation
|
| Filename | Overview |
|---|---|
| lib/TinyEXIF/TinyEXIF.cpp | Updates the vendored parser with bounds-safe EXIF traversal and expanded metadata handling; no eligible follow-up finding was established. |
| lib/TinyEXIF/TinyEXIF.h | Adds the updated TinyEXIF API, metadata structures, and field-presence interface. |
| src/HeifPicture.cpp | Prevents metadata-length underflow and passes the remaining buffer length after skipping the HEIF EXIF prefix. |
| lib/TinyEXIF/README.md | Documents the updated field-presence API and current licensing. |
| lib/kodi-TinyEXIF-note.txt | Records the new vendored TinyEXIF revision. |
Reviews (2): Last reviewed commit: "Do not read past the end of the EXIF met..." | Re-trigger Greptile
|
Jenkins not happy? Needs a rebase maybe? |
The copy here was pinned at 6e56015 (April 2021) and is missing two upstream memory-safety fixes: 841e2929, a heap buffer overflow in EntryParser::Fetch, and b6ea1b7b, an integer overflow in the parseString bounds check. The first is reachable. Fuzzing the pinned copy under ASan segfaulted after 18 executions: EntryParser::parse32 TinyEXIF.cpp:283 EntryParser::parseRational TinyEXIF.cpp:297 EntryParser::Fetch(double&, unsigned) TinyEXIF.cpp:256 EXIFInfo::parseIFDExif TinyEXIF.cpp:615 which is exactly the function 841e2929 adds a bounds check to. EXIF parsing runs whenever Kodi reads tags for a picture, so the input is attacker controlled. The upstream proof-of-concept samples do not reproduce it - the older parser rejects them as corrupt before reaching that code - so this was found by fuzzing the pinned version rather than by replaying published cases. After the update that input parses cleanly and 3.3M fuzz executions found nothing. Only parseFrom(), parseFromEXIFSegment(), ImageWidth, ImageHeight and Orientation are used here, all unchanged upstream. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The buffer was advanced by type.length() but the full metadata.size() was still passed as the length, so the parser could read that many bytes beyond the end of the vector. A block shorter than the type string underflowed the subtraction that should have been there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ebf9e70 to
69cf1e4
Compare
|
Rebased — you were right. My earlier "the red clears once the API PRs merge" was wrong: this branch was still based on the pre-merge Now on current Written by my AI co-author (Claude Code); posted from my account. |
|
Thanks! I'll handle releases when I get a chance. |
Updates the vendored TinyEXIF from
6e56015(April 2021) to8c22aff(August 2026).Why
The pinned copy is missing two upstream memory-safety fixes —
841e2929(heap buffer overflow inEntryParser::Fetch) andb6ea1b7b(integer overflow in theparseStringbounds check).The first is reachable here. Fuzzing the pinned copy under ASan segfaulted after 18 executions:
That is exactly the function
841e2929adds the missingoffset + 8 > lencheck to. EXIF parsing runs whenever Kodi reads tags for a picture, so the input is attacker-controlled.Worth noting for anyone re-checking this: upstream's published PoC samples do not reproduce it. The older parser rejects them as
PARSE_CORRUPT_DATAbefore reaching that code, so replaying them says "not affected". The crash was found by fuzzing this pinned version specifically.Verification
6e56015)8c22aff)Only
parseFrom(),parseFromEXIFSegment(),ImageWidth,ImageHeightandOrientationare used here, all unchanged upstream. Builds clean.CI will be red, and not because of this
This branch is off
Piers, which does not compile againstxbmc/xbmcmaster any more: ImageDecoder API 3.1.0 (xbmc/xbmc#29068) changed theDecode()signature, and CI here builds against master. #91 fixes that, and the two compose — I built this branch on top of it and both compile.They are independent concerns and can merge in either order.
Written by my AI co-author (Claude Code); posted from my account.