mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
679892f56e
commit
362a9ecc4f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user