Repository navigation
Reject repeated clap, irot and imir transforms on an item - #18
laurens-pilot wants to merge 3 commits into
Conversation
A grid tile item could carry up to 65,534 clap or irot associations, and preflight and decode walked every one of them for every grid reference, so decode time scaled with references times transforms (a 128x128 grid of one tile with 65,534 identity claps took about 49 s). libheif rejects a second irot, imir or clap on one item as a format rule (GHSA-7qm8-hj35-269r, v1.23.7) and libavif applies only the first of each, so resolve each distinct tile item's transforms once into at most one per type, rejecting duplicates and dropping identity rotations. Preflight and decode now do constant transform work per reference.
A primary item accepted any number of clap, irot and imir associations. The per-pixel transform paths walk every step for every output pixel, so the cost scaled with transforms times pixels: a sips-encoded 1001x777 HEIC took 5.8 s with 2,550 imir associations against 0.55 s without. Apply the rule already used for grid tiles: at most one clap, irot and imir per item, matching libheif's GHSA-7qm8-hj35-269r check. Unlike grid tiles, identity rotations stay in the returned list because parse_primary_item_transform_properties is public.
decode_bounded parses item properties with its own reader, which only capped the total at 16 transforms, so it still accepted repeated clap, irot or imir on a grid primary or tile that decode_bytes_to_rgba now rejects. Reject a second transform of the same type there too.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Superseded by ente#30. |
A grid tile item or a primary item could carry thousands of repeated
clap,irotorimirassociations, and decoding walked every one of them for each grid reference or each output pixel. Following libheif 1.23.7 (GHSA-7qm8-hj35-269r), an item may now carry at most one transform of each type. A second one is rejected by the grid-tile parser, the primary-item parser (HEIC, AVIF and uncompressed) and thedecode_boundedparser, and identity tile rotations are dropped once at extraction.clapsirot0°imirsclapper tileReal files are unaffected: 9 sips-encoded HEICs and the 6 ente test-fixture HEICs decode byte-identically before and after, through both
decode_bytes_to_rgbaanddecode_bounded.Compatibility: files with repeated transforms now fail in every format, including AVIF, where libavif would use the first of each. For such files, the metadata helpers that swallow parse errors (
primary_item_has_orientation_transform,exif_orientation_hint*, grid tile colour inheritance) report no container orientation or tile colour. The public error enums gainDuplicateGridTileTransformandDuplicateTransform.