fix: refuse HEIC plane copy when decode size mismatches handle (#14) - #56
Merged
McanKul merged 1 commit intoAug 25, 2026
Merged
Conversation
After heif_decode_image, compare interleaved plane width/height to the handle before any copy. Mismatched grid/irot layouts return INVALID_IMAGE instead of reading off the plane (Windows 0xc0000005). Fixes McanKul#14.
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.
Summary
Addresses #14: HEIC/HEIF import can ACCESS_VIOLATE on real phone photos after #29 and #49.
After
heif_decode_image, OffPDF now inspects the decoded interleaved plane (width/height/chroma/bpp) and refuses to copy if it does not match the handle-sized output buffer.copy_pixelssizes rows from the plane. Decode requests 8-bit conversion when options can be allocated.This branch is from
developmentonly. It does not include #54 or #55.In scope
irotstand-ins)AppErrorINVALID_IMAGEOut of scope
Why
#49 validated stride and dest length using handle dimensions. A shorter or swapped plane can still pass
stride >= rowand then read off the buffer (0xc0000005on Windows).Validation
npm run typechecknpm test(179)cargo test --manifest-path src-tauri/Cargo.toml --lib(97)cargo test -p heif-rs --manifest-path src-tauri/Cargo.toml --libPrivacy Checklist