From 8aa1331c09a9b899f48d97f097bb49b7d458be1c Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 6 Aug 2013 15:44:51 +0800 Subject: vmdk: check granularity field in opening Granularity is used to calculate the cluster size and allocate r/w buffer. Check the value from image before using it, so we don't abort() for unbounded memory allocation. Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- tests/qemu-iotests/059 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/qemu-iotests/059') diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 index 9dc7f64..9545e82 100755 --- a/tests/qemu-iotests/059 +++ b/tests/qemu-iotests/059 @@ -43,7 +43,13 @@ _supported_fmt vmdk _supported_proto generic _supported_os Linux -granularity_offset=16 +granularity_offset=20 + +echo "=== Testing invalid granularity ===" +echo +_make_test_img 64M +poke_file "$TEST_IMG" "$granularity_offset" "\xff\xff\xff\xff\xff\xff\xff\xff" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir # success, all done echo "*** done" -- cgit v1.1