Skip to content

craft-tiff: shared child IFDs, multi-string ASCII, parse_with_status (ports of open LightCraft PRs) - #842

Merged
dylanmtaylor merged 2 commits into
mainfrom
port/tiff-app-prs
Nov 11, 2026
Merged

dylanmtaylor merged 2 commits into
mainfrom
port/tiff-app-prs

Conversation

@dylanmtaylor

Copy link
Copy Markdown
Member

What this is

Two open LightCraft pull requests change crates/tiff, the copy that lightcraft#4088 deletes. This carries their TIFF parts here. Each commit keeps its original author.

What changed (crates/tiff)

  1. Shared child IFDs and multi-string ASCII. Ported from LR-META-EXIF: TIFF keeps shared child IFDs and multi-string ASCII values lightcraft#3002 by @emmertex (approved there).
    • Two pointers to the same child IFD (two SubIFDs entries, or an Exif IFD shared by two directories) were treated as a loop and the second was dropped. Loops are now detected on the current parent path only. A shared IFD is parsed once and copied for later pointers; each copy is charged the IFDs, entries and value bytes of the first parse, so max_ifds, max_entries_total and the value budget still bound the result.
    • Value::Ascii keeps every NUL-separated string. New Value::as_strings. as_str and as_bytes return the first string, as before for single-string fields.
  2. Tiff::parse_with_status. Ported from LR-META-EXIF-FULL: validate EXIF GPS subdivisions lightcraft#3766 by @ronibalthazar.
    Returns the same best-effort tree plus complete: bool, false when an IFD table was truncated, an entry was skipped, a child pointer could not be followed (or follow_children is off and a pointer tag is present), a pointer field holds more than one offset, a tag is duplicated, or the IFD chain could not be read to its end. parse and parse_with are unchanged. Adds tags::PHOTOSHOP_IMAGE_RESOURCES, GPS_DEST_LATITUDE, GPS_DEST_LONGITUDE.

The two PRs both rewrite the same part of reader.rs. Combined here: a second pointer to an already-read IFD counts as read, and a next-IFD pointer that loops back into the chain is reported incomplete. One test covers both.

Behaviour changes

  • A TIFF that names one child IFD twice now yields it twice (sub_ifds, exif, gps, interop).
  • Value::Ascii of a multi-string field now holds all the strings separated by NUL, where it held only the first. as_str(), as_bytes() and Ifd::string() still give the first string.

Not ported

Checks run

  • cargo test -p craft-tiff: 25 unit tests and 16 integration tests passed.
  • cargo clippy -p craft-tiff --all-targets -- -D warnings: clean.
  • cargo fmt --check -p craft-tiff: clean.

Checks not run

Workspace-wide tests. I did not separately run the new shared-IFD tests against the old reader; their assertions describe the old result (second pointer dropped). No real camera files.

emmertex and others added 2 commits November 11, 2026 19:02
… ASCII value

Two pointers to the same child IFD (two SubIFDs entries, or an Exif IFD
shared by two directories) were treated as a loop and the second was
dropped. Loops are now detected on the current parent path only; a shared
IFD is parsed once and copied for later pointers, and each copy is charged
its IFDs, entries and value bytes so max_ifds, max_entries_total and the
value budget still hold.

ASCII values keep every NUL-separated string (Value::as_strings); as_str
and as_bytes return the first.

Ported from storytold/lightcraft#3002.
… was read

The reader is best effort: truncated tables, over-budget values, dangling
pointers and unfollowed children are skipped silently. A caller that must
tell a clean absence from something it could not inspect (a privacy scan
for GPS data) gets the same tree plus a completeness flag.

Also adds the PHOTOSHOP_IMAGE_RESOURCES and GPS destination tag constants.

Ported from storytold/lightcraft#3766. On top of the shared-child change,
a second pointer to an IFD already read counts as read, and a next pointer
that loops back to the chain is incomplete.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4c6fe7c and 78c71f4.

Files selected for processing: 4

  • crates/tiff/README.md
  • crates/tiff/src/lib.rs
  • crates/tiff/src/reader.rs
  • crates/tiff/src/tags.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

Copy link
Copy Markdown

@dylanmtaylor
dylanmtaylor merged commit 9adca4a into main Nov 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants