Skip to content

Commit 8c022d8

Browse files
kevmwMichael Tokarev
authored andcommitted
iotests/270: Don't store data-file with json: prefix in image
We want to disable filename parsing for data files because it's too easy to abuse in malicious image files. Make the test ready for the change by passing the data file explicitly in command line options. Cc: [email protected] Signed-off-by: Kevin Wolf <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Hanna Czenczek <[email protected]> (cherry picked from commit 7e11106) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 0bbe8f9 commit 8c022d8

File tree

1 file changed

+11
-3
lines changed
  • tests/qemu-iotests

1 file changed

+11
-3
lines changed

tests/qemu-iotests/270

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,16 @@ _make_test_img -o cluster_size=2M,data_file="$TEST_IMG.orig" \
6060
# "write" 2G of data without using any space.
6161
# (qemu-img create does not like it, though, because null-co does not
6262
# support image creation.)
63-
$QEMU_IMG amend -o data_file="json:{'driver':'null-co',,'size':'4294967296'}" \
64-
"$TEST_IMG"
63+
test_img_with_null_data="json:{
64+
'driver': '$IMGFMT',
65+
'file': {
66+
'filename': '$TEST_IMG'
67+
},
68+
'data-file': {
69+
'driver': 'null-co',
70+
'size':'4294967296'
71+
}
72+
}"
6573

6674
# This gives us a range of:
6775
# 2^31 - 512 + 768 - 1 = 2^31 + 255 > 2^31
@@ -74,7 +82,7 @@ $QEMU_IMG amend -o data_file="json:{'driver':'null-co',,'size':'4294967296'}" \
7482
# on L2 boundaries, we need large L2 tables; hence the cluster size of
7583
# 2 MB. (Anything from 256 kB should work, though, because then one L2
7684
# table covers 8 GB.)
77-
$QEMU_IO -c "write 768 $((2 ** 31 - 512))" "$TEST_IMG" | _filter_qemu_io
85+
$QEMU_IO -c "write 768 $((2 ** 31 - 512))" "$test_img_with_null_data" | _filter_qemu_io
7886

7987
_check_test_img
8088

0 commit comments

Comments
 (0)