Repository navigation
craft-tiff: shared child IFDs, multi-string ASCII, parse_with_status (ports of open LightCraft PRs) - #842
Merged
Conversation
… 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.
Contributor
|
Warning Review limit reachedYou'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. View limit details
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. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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)SubIFDsentries, 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, somax_ifds,max_entries_totaland the value budget still bound the result.Value::Asciikeeps every NUL-separated string. NewValue::as_strings.as_strandas_bytesreturn the first string, as before for single-string fields.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 (orfollow_childrenis 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.parseandparse_withare unchanged. Addstags::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
sub_ifds,exif,gps,interop).Value::Asciiof a multi-string field now holds all the strings separated by NUL, where it held only the first.as_str(),as_bytes()andIfd::string()still give the first string.Not ported
tags.rsconstants (DNG 1.6 semantic masks, ProfileGainTableMap): already onmainhere.image.rsto use LightCraft's test time scale. That helper is LightCraft's; nothing to port.parse_with_statusfrom here.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.