[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/18] vmdk: Check VMFS extent line field number
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 10/18] vmdk: Check VMFS extent line field number |
Date: |
Fri, 20 Dec 2013 16:46:48 +0100 |
From: Fam Zheng <address@hidden>
VMFS extent line in description file should be with 4 fields:
RW <size> VMFS "file-name.vmdk"
Check the number explicitly and report error if offset is appended as
FLAT, which should be invalid format.
Reported-by: Paolo Bonzini <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/vmdk.c | 9 +++++++--
tests/qemu-iotests/059 | 14 ++++++++++++++
tests/qemu-iotests/059.out | 5 +++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 0734bc2..7917ad0 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -749,9 +749,14 @@ static int vmdk_parse_extents(const char *desc,
BlockDriverState *bs,
return -EINVAL;
}
} else if (!strcmp(type, "VMFS")) {
- flat_offset = 0;
+ if (ret == 4) {
+ flat_offset = 0;
+ } else {
+ error_setg(errp, "Invalid extent lines:\n%s", p);
+ return -EINVAL;
+ }
} else if (ret != 4) {
- error_setg(errp, "Invalid extent lines: \n%s", p);
+ error_setg(errp, "Invalid extent lines:\n%s", p);
return -EINVAL;
}
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 73941c3..65bea1d 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -81,6 +81,20 @@ IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G
$QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid:
XXXXXXXX/'
echo
+echo "=== Testing malformed VMFS extent description line ==="
+cat >"$TEST_IMG" <<EOF
+# Disk DescriptorFile
+version=1
+CID=58ab4847
+parentCID=ffffffff
+createType="vmfs"
+
+# Extent description
+RW 12582912 VMFS "dummy.vmdk" 1
+EOF
+_img_info
+
+echo
echo "=== Testing version 3 ==="
_use_sample_img iotest-version3.vmdk.bz2
_img_info
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
index 4ff935c..16ab7c6 100644
--- a/tests/qemu-iotests/059.out
+++ b/tests/qemu-iotests/059.out
@@ -2038,6 +2038,11 @@ Format specific information:
filename: TEST_DIR/t-f500.vmdk
format: FLAT
+=== Testing malformed VMFS extent description line ===
+qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent lines:
+RW 12582912 VMFS "dummy.IMGFMT" 1
+
+
=== Testing version 3 ===
image: TEST_DIR/iotest-version3.IMGFMT
file format: IMGFMT
--
1.8.4.2
- [Qemu-devel] [PULL 00/18] Block patches, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 01/18] sheepdog: fix dynamic grow for running qcow2 format, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 02/18] vring: create a common function to parse descriptors, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 03/18] vring: factor common code for error exits, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 04/18] dataplane: change vring API to use VirtQueueElement, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 05/18] dataplane: replace hostmem with memory_region_find, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 07/18] block/iscsi: Fix compilation for libiscsi 1.4.0 (API change), Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 06/18] qapi-schema: fix QEMU 1.8 references, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 08/18] block: vhdx - improve error message, and .bdrv_check implementation, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 09/18] docs: updated qemu-img man page and qemu-doc to reflect VHDX support., Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 10/18] vmdk: Check VMFS extent line field number,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 11/18] vmdk: Allow vmdk_create to work with protocol, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 12/18] qemu-iotests: drop duplicate virtio-blk initialization failure, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 13/18] mirror: Don't close target, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 14/18] mirror: Move base to MirrorBlockJob, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 15/18] block: Add commit_active_start(), Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 16/18] commit: Support commit active layer, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 17/18] qemu-iotests: Update test cases for commit active, Stefan Hajnoczi, 2013/12/20
- [Qemu-devel] [PULL 18/18] commit: Remove unused check, Stefan Hajnoczi, 2013/12/20