block: vhd: fix incomplete bounds check in sync I/O worker

The sync I/O worker only checked that the operation offset did
not start past the end of the virtual disk (offset >= size) -
did not verify that the operation end (offset + len) stays
within bounds.

A read or write that started inside the image but extended
beyond the logical size was silently passed to the raw backend.

The async io_uring worker already had the correct check
(offset + len > size with overflow protection). I extracted it
into a shared helper in worker/common.rs and reused inside the
sync path to eliminate duplication and close the gap.

Fixes #8311

Signed-off-by: Alexander Lvov <alexander.lvov.git@gmail.com>
This commit is contained in:
Alexander Lvov
2026-06-11 17:22:47 +03:00
committed by Rob Bradford
parent 7ca99204ed
commit e0801bda3b
5 changed files with 107 additions and 54 deletions
+1
View File
@@ -9,4 +9,5 @@
#[cfg(feature = "io_uring")]
pub(crate) mod async_uring;
mod common;
pub(crate) mod sync;