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
Description
In
write_nv12_to_va_surfaceandwrite_nv12_to_mapping(both invaapi_av1.rsandvaapi_h264.rs), the NV12/I420 copy loops use: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-372correctly returns errors on bounds violations.Suggested fix
Found in
PR #279 — Devin Review comment #47