Skip to content

fix(ffmpeg): make odd-width scalar reference reads bounded and deterministic - #60

Open
huangruiteng wants to merge 1 commit into
ByteDance-Seed:mainfrom
huangruiteng:codex/ffmpeg-reference-bounds-20261108
Open

huangruiteng wants to merge 1 commit into
ByteDance-Seed:mainfrom
huangruiteng:codex/ffmpeg-reference-bounds-20261108

Conversation

@huangruiteng

Copy link
Copy Markdown

Odd-width packed RGB conversions can read a missing partner pixel past the logical source row. A tight BGR24 row ending at a protected page faults in the scalar reference, and changing row padding can change its U/V result.

The shared C shim now owns a reusable zero-padded input buffer for odd-width RGB24, BGR24, RGBA and BGRA. It copies logical bytes, including negative-stride inputs, and supplies the same zero-valued partner as the existing zero-padded public image buffers. Even-width inputs retain the direct conversion path.

Both work and judge image builds run the same guard-page and padding-independence check after compiling their reference. Task version becomes 1.1.0 because the reference binary and odd-width timing boundary change. Rebuild both task images and identify results by reference version when comparing historical scores.

Validation used real FFmpeg n7.1 static libraries in an isolated linux/amd64 task image. The original shim reproduced SIGSEGV for a tight width-3 BGR24 input. The fixed shim passed tight and colored-padding cases over four packed formats, multiple odd widths and heights, negative strides, and byte-for-byte parity against the original shim for even widths and zero-padded odd widths. All four test methods passed with the previous reference supplied. The normal image-build command executes the two safety methods and skips the two optional legacy-comparison methods.

Both shims compile with the task's build recipe plus -Wall -Wextra -Werror. A sampled process-only comparison under emulation measured fixed/old medians of 1.024 for 128×128 and 1.011 for 129×128. The samples were noisy and do not qualify native-host performance. The complete work and judge images have not been rebuilt in this validation.

The change is independent of the development-oracle work in #59 and the staged failure-feedback work in #58.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>

This branch has not been deployed

No deployments
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