From eb9d6c2a0f627b521a1b80634433952095d729e9 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 21 Jan 2026 21:05:13 +0100 Subject: [PATCH] nihav_core/scale: copy only the common part of the buffer For padded pictures strides and offsets may be the same while overall size differs, leading to panic during copy. --- nihav-core/src/scale/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nihav-core/src/scale/mod.rs b/nihav-core/src/scale/mod.rs index 93d42a4..85f7b83 100644 --- a/nihav-core/src/scale/mod.rs +++ b/nihav-core/src/scale/mod.rs @@ -235,7 +235,8 @@ fn copy(pic_in: &NABufferType, pic_out: &mut NABufferType) if same { let sdata = sbuf.get_data(); let ddata = dbuf.get_data_mut().unwrap(); - ddata.copy_from_slice(&sdata[0..]); + let copy_len = sdata.len().min(ddata.len()); + ddata[..copy_len].copy_from_slice(&sdata[..copy_len]); } else { let sdata = sbuf.get_data(); for comp in 0..src_components.min(dst_components) { -- 2.39.5