Repository navigation
libnsgif: Resume a scan at the frame's start after the end of the data (#2515) - #2516
Conversation
|
Coordinator tick (2026-10-27). Two things keep this PR from the queue: it is 1. Windows Tier 2 failure (run 40377242953): the canonical-manifest build panics. The message comes from 2. Rebase: master generates the bench-unit list (#1997), so Take master's 3. Stacked on #2514. This PR carries #2514's commits, so it should be rebased onto master only after #2514 lands; rebasing now drags the pre-rebase copies of those commits in again. I did not push a rebase: it needs a force-push and this session cannot rewrite a remote branch. |
|
Windows Tier 2 fails on this head, and it is the manifest move in this PR rather than a flake.
The string comes from The only manifest-side change in this PR is the libnsgif move, and it lines up with exactly that check: Everything else is green — 36 passed, and the linux/macOS Tier 2 legs, the cmocka test and the oracle benches are fine. Two other things while I have the pen:
|
|
Thanks, on it. That run (40377242953) is from when this branch was stacked on the pre-fix head of #2514. The fix is in #2514 as I will rebase this PR onto master after #2514 merges (conflicts expected only in On the design question: the |
…2515) gif_scan_incremental (cmocka) and render::gif::gif_scan_incremental (Tier 1) now expect a scan in two parts, split at every byte of the writer's three-frame GIF, and a byte-by-byte scan to give the info and frame info of a whole scan, with the end of the data until the first frame is complete and a success after. They characterized the bad frame before (#2510). RED: a split inside a frame's image data, local colour table or on an extension's last byte (the first is byte 51) gives NSGIF_ERR_DATA_FRAME for good, in the C and in Rust. Refs #2515 Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2515) nsgif__process_frame kept the position where a frame's parse stopped as the resume point of the next nsgif_data_scan, also when the parse ended with NSGIF_ERR_END_OF_DATA. By then the frame's extensions, image descriptor and colour table were behind that position, so the next scan read the frame's image data (or an extension's terminator) as the next block: NSGIF_ERR_DATA_FRAME from then on, also with all the data. A caller that scans a GIF in parts lost it whenever a part ended inside a frame. OBS scans whole files; upstream libnsgif has the same code. Now a scan that ends with the end of the data in a frame resumes at the frame's start (frame_offset, kept already), and the next scan reads the whole frame again. A second read writes the same frame fields, and the loop count of an application extension is set, not added. The lzw_data_length that a partial scan adds up stays as it was; only nsgif_data_complete reads it, as "greater than 0". Fixed in the vendored C (libobs/graphics/libnsgif/gif.c.h, still built in libobs-c-reference and the C oracle) and in obs_graphics::gif, so the Tier 3 parity (render::gif_parity, which scans in parts) keeps comparing like with like. GREEN: gif_scan_incremental (cmocka and Tier 1) passes; Tier 3 3/3. Fixes #2515 Co-Authored-By: Claude Opus 5.5 <[email protected]>
cceaecb to
a72ef1b
Compare
|
Rebased onto Why the rebase moved two commits: the branch carried the three The Windows Tier 2 red was not yours. Added: a PR CI now runs fresh against |
The row still listed the upstream resume (where the frame's parse stopped) as kept and characterized. With this PR a scan resumes at the frame's start; the row now says so and names the upstream behaviour. Refs #2515 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the rebase and the ledger line; the wording of the Added One correction for the record: the Windows Tier 2 failure in run 40377242953 was Local checks on the same code (before the README commit): CT104 cmocka (nsgif, image_file, gif, state stacks, sprite, effect parser) 12/12 against libobs-c-reference and the hybrid libobs; mbmax |
|
Local Windows Tier 2 (VM, Windows 11, VS 2026 Build Tools,
This PR's CI selects no Windows or macOS Tier 2 lane (the ci_scope gap: test |
Fixes #2515
A scan of a GIF in parts lost the GIF when a part ended inside a frame: every later
nsgif_data_scanreturnedNSGIF_ERR_DATA_FRAME, also with all the data. This PR resumes the scan at the frame's start, in the vendored C and inobs_graphics::gif. Stacked on #2514 (it changesobs_graphics::gif); the diff of this PR is the last two commits.Cause
nsgif__process_frame(scan mode) saved the position where the frame's parse stopped as the resume point, also afterNSGIF_ERR_END_OF_DATA. By then the frame's extensions, image descriptor and colour table were behind that position, so the next scan read the frame's image data, or an extension's block terminator, as the next block. Upstream libnsgif has the same code; OBS was not affected, sincegs_image_filescans whole files.Fix
After
NSGIF_ERR_END_OF_DATAin a frame, the next scan starts at the frame's start (frame_offset, kept already) and reads the whole frame again:lzw_data_lengththat a partial scan adds up stays as it was: onlynsgif_data_completereads it, as "greater than 0".The same change is in
libobs/graphics/libnsgif/gif.c.h(still built inlibobs-c-referenceand the C oracle) and inGif::process_frame, so Tier 3 (render::gif_parity, which scans in parts) keeps comparing like with like.RED → GREEN
8b1e38bc6:gif_scan_incremental(cmocka and Tier 1) expects a scan in two parts, split at every byte of the test's three-frame GIF, and a byte-by-byte scan to give the info and frame info of a whole scan. It characterized the bad frame before (rust: Port the libnsgif state machine and public API (graphics/libnsgif/gif.c.h) to obs-graphics (libnsgif slice 2c) #2510). Fails at byte 51 (the last byte of frame 0's graphic control extension), in the C and in Rust.cceaecbc6: the fix;gif_scan_incrementalpasses in both, Tier 3 3/3. The README row ofobs-graphics::gifno longer lists the old behaviour as kept.Tier 2 (Linux x86_64, Debian 13)
ci/local_gate.py --lane lint) passes.test_nsgif_decode(39/39 on the C),test_nsgif_decode_rust(39/39 on the shims, with AddressSanitizer and UBSan),test_image_file,test_image_file_version,test_image_file_version_filetimeandtest_media_gif_last_framepass on the hybrid libobs and onlibobs-c-reference(6/6 each).Checklist
master(after obs-graphics: Port the libnsgif state machine and public API (#2510) #2514)🤖 Generated with Claude Code