Skip to content

Clip GIF playback frames to logical screen - #183

Merged
danoli3 merged 1 commit into
masterfrom
fix/gif-playback-frame-bounds
Oct 17, 2026
Merged

danoli3 merged 1 commit into
masterfrom
fix/gif-playback-frame-bounds

Conversation

@danoli3

@danoli3 danoli3 commented Oct 17, 2026

Copy link
Copy Markdown
Owner

The GIF playback path composites frame rectangles onto the logical-screen canvas without clipping their horizontal bounds. A frame whose left + width extends past the canvas can write beyond the destination row. The disposal-background path has the same issue. This change clips both frame paths to the logical screen while keeping valid in-bounds pixels unchanged.

The other two findings in the report are already fixed on master: RAS loop counters and allocation sizing were fixed in d474400, and PBM RLE bounds/short-read handling were fixed in #161 and #162.

Adds crafted regression cases for a partially off-screen GIF frame, a far-off-screen frame, its disposal clear, and a 70,000-pixel RAS row.

Validation: the ASan build passes all 9 TestAPI tests. The GIF case reports a heap-buffer-overflow in GifPlaybackCompositeFrame on the unfixed origin/master baseline; the RAS case reports a heap-buffer-overflow on report commit 625117b; the IFF RLE regression case also reports a heap-buffer-overflow on 625117b. The current fixed build passes all three cases.

@danoli3
danoli3 merged commit 96f4099 into master Oct 17, 2026
64 checks passed
haobinnan pushed a commit to haobinnan/FreeImage that referenced this pull request Oct 31, 2026
The CNA published IDs for the IFF PBM RLE overflow fixed in 3.19.22
(danoli3#156, danoli3#161) and the GIF_PLAYBACK compositing overflow fixed in 3.19.25
(danoli3#183). Credit the reporters, and note that 3.19.25 only added a RAS
regression test: the RAS fix shipped in 3.19.14 (d474400) under
CVE-2024-28578 and CVE-2024-28580.
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.

1 participant