block: qcow: Test rejection of backing file offset with zero size

Cover the malformed header case where backing_file_offset is non
zero but backing_file_size is zero, which must be rejected with the
new dedicated error.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-06-01 17:35:16 +02:00
committed by Rob Bradford
parent 679892f56e
commit 362a9ecc4f

View File

@@ -2759,6 +2759,12 @@ mod unit_tests {
assert!(matches!(err, Error::BackingFileSizeWithoutOffset(16)));
}
#[test]
fn backing_file_offset_without_size() {
let err = read_header_with_patched_backing(1024, 0).unwrap_err();
assert!(matches!(err, Error::BackingFileOffsetWithoutSize(1024)));
}
#[test]
fn backing_file_fits_at_cluster_end() {
let cluster_size = 1u64 << DEFAULT_CLUSTER_BITS;