Skip to content

VA-API NV12 upload: silent bounds-check skipping can mask frame corruption #291

@staging-devin-ai-integration

Description

Description

In write_nv12_to_va_surface and write_nv12_to_mapping (both in vaapi_av1.rs and vaapi_h264.rs), the NV12/I420 copy loops use:

if s + w <= src.len() && d + w <= dest.len() {
    dest[d..d + w].copy_from_slice(&src[s..s + w]);
}

These guards silently skip rows when bounds checks fail, rather than returning an error. A corrupted or truncated input frame would produce a partially-black VA surface without any warning, leading to hard-to-debug visual artifacts.

By contrast, the NVDEC decoder in nv_av1.rs:341-372 correctly returns errors on bounds violations.

Suggested fix

Found in

PR #279 — Devin Review comment #47

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions