Skip to content

[Decode] Keep JPEG slice buffer state consistent across errors - #2090

Draft
XinfengZhang wants to merge 1 commit into
intel:masterfrom
XinfengZhang:fix-jpeg-state-cleanup
Draft

XinfengZhang wants to merge 1 commit into
intel:masterfrom
XinfengZhang:fix-jpeg-state-cleanup

Conversation

@XinfengZhang

Copy link
Copy Markdown
Contributor

JPEG slice-buffer bookkeeping can retain rendered flags after a failed picture
and overwrite a live slot when a lower-index buffer is destroyed. This can make
the tracked bitstream size smaller than the data copied into the destination.

Preserve live slot indices, invalidate render-order references on destruction,
initialize new slots completely, and reset rendered state across picture errors.
Validate rendered buffers and total size before allocation, check copies against
the actual remaining destination capacity, and release the previous legacy
bitstream buffer before replacing it during a retry.

Validation: extracted production functions from both decoder paths passed 200
state-transition sequences each under ASan and UBSan, including destruction,
slot reuse, allocation/mapping/copy failures, retries, and valid recovery. The
tests use CPU-backed buffers and mocked driver resource operations. A complete
driver build and GPU execution were not performed.

Preserve live JPEG slice slots when another buffer is destroyed and invalidate
render-order entries for released buffers. Fully initialize new slots and reset
picture tracking on BeginPicture and every SetDecodeParams return.

Validate the rendered buffers and accumulated size before allocation, then
check copies against the actual remaining bitstream capacity. Release any
previous legacy bitstream buffer before replacing it during an error retry.
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