block: qcow: Test rejection when backing file overlaps header

Cover the case where backing_file_offset points inside the fixed
header fields, which the new header overlap check must reject.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-06-01 16:12:48 +02:00
committed by Rob Bradford
parent 9c85aab85d
commit 05cac5657c

View File

@@ -2747,6 +2747,12 @@ mod unit_tests {
)); ));
} }
#[test]
fn backing_file_offset_inside_header() {
let err = read_header_with_patched_backing(64, 16).unwrap_err();
assert!(matches!(err, Error::BackingFileOverlapsHeader(_, _, _)));
}
#[test] #[test]
fn backing_file_fits_at_cluster_end() { fn backing_file_fits_at_cluster_end() {
let cluster_size = 1u64 << DEFAULT_CLUSTER_BITS; let cluster_size = 1u64 << DEFAULT_CLUSTER_BITS;