Repository navigation
obs-c-oracle: Fix the gif bench's pixel read - #2616
Merged
Merged
Conversation
The gif bench pair ignored the results of nsgif_create() and nsgif_frame_decode(), so a failed decode would leave the bitmap NULL and fault on the pixel read. Assert NSGIF_OK and a bitmap on both sides, and read the last pixel through one helper. Every call now returns NSGIF_OK with a bitmap, and the bench still faults: the read itself is wrong, which the next commit fixes. Refs #2614.
nsgif_frame_decode() hands back the bitmap the bench's create callback made, a boxed Vec<u32>, and the bench indexed that handle as if it were the pixels, reading 8 MB past a 24-byte box. The decode never failed. Read the last pixel through get_buffer, as libnsgif does, so the port_comparison bench test runs past the gif module again. Fixes #2614.
rdoupe
force-pushed
the
fix/2614-bug-obs-c-oracle-port-comparison
branch
from
October 27, 2026 12:26
8ff485a to
f03572d
Compare
rdoupe
marked this pull request as ready for review
October 27, 2026 12:36
6 of 7 tasks
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.
Fixes #2614
What and why
The
port_comparisonbench test (soldr cargo test -p obs-c-oracle --locked --bench port_comparison) segfaults on master in thegifmodule, added with the libnsgif port (#2514), so every module after it, and the per-module allocation check, never runs.The issue suspected a failed decode leaving the bitmap NULL. It doesn't: with every libnsgif return checked,
nsgif_createand all fivensgif_frame_decodecalls returnNSGIF_OKwith a bitmap, on both the Rust and the C side, and the bench still faults. The fault is the bench's own read:nsgif_frame_decodehands back the bitmap handle that the bench'screatecallback made (a boxedVec<u32>), and the bench read the last pixel by indexing that handle as if it were the pixel buffer, 8 MB past a 24-byte box. The fix reads the pixel through the bench's ownget_buffercallback, as libnsgif does. The decoders are unchanged.vpacher reached the same diagnosis independently on the issue, with an lldb trace on macOS: there the stray read is a SIGBUS, and in the bench profile (
cargo bench) it lands in mapped, zeroed memory, so both sides read 0 and match, which is why the bench passed when the port was measured.No upstream issue (the bench is obs-rust's own).
RED → GREEN
NSGIF_OKand a non-null bitmap); all checks pass and the bench test still dies withsignal: 11, SIGSEGV: invalid memory referenceright afterTesting encoder_size/rate_route/1024/c.gif/scan_decode_5x1080prust and c bothSuccess).uv run ci/local_gate.py --test-diff origin/master: 4370 passed, 6 skipped;--lane lintand--lane crossok; Windows MSVC clippy (--all-targets -D warnings) clean. Runs were on f03572d; Tier 2 did not run locally (no Docker access on the build host) and is left to PR CI, which selects it only for libobs paths.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): N/A, none