[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/17] block/vpc: check that the image has not been t
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 05/17] block/vpc: check that the image has not been truncated |
Date: |
Tue, 29 Oct 2013 17:30:57 +0100 |
From: Peter Lieven <address@hidden>
this adds a check that a dynamic VHD file has not been
accidently truncated (e.g. during transfer or upload).
Signed-off-by: Peter Lieven <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vpc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block/vpc.c b/block/vpc.c
index b5dca39..627d11c 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -260,6 +260,13 @@ static int vpc_open(BlockDriverState *bs, QDict *options,
int flags,
}
}
+ if (s->free_data_block_offset > bdrv_getlength(bs->file)) {
+ error_setg(errp, "block-vpc: free_data_block_offset points after "
+ "the end of file. The image has been truncated.");
+ ret = -EINVAL;
+ goto fail;
+ }
+
s->last_bitmap_offset = (int64_t) -1;
#ifdef CACHE
--
1.8.1.4
- [Qemu-devel] [PULL 00/17] Block patches, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 01/17] qapi: fix documentation example, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 04/17] qemu-img: add special exit code if bdrv_check is not supported, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 02/17] qcow2: Restore total_sectors value in save_vmstate, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 05/17] block/vpc: check that the image has not been truncated,
Kevin Wolf <=
- [Qemu-devel] [PULL 03/17] qcow2: Unset zero_beyond_eof in save_vmstate, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 06/17] qemu-iotests: Test for loading VM state from qcow2, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 07/17] qcow2: Flush image after creation, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 08/17] exec: Fix bounce buffer allocation in address_space_map(), Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 09/17] ide-test: Check what happens with bus mastering disabled, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 10/17] tests: Multiboot mmap test case, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 11/17] block: Don't copy backing file name on error, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 12/17] sheepdog: explicitly set copies as type uint8_t, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 13/17] sheepdog: pass copy_policy in the request, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 14/17] ahci: fix win7 hang on boot, Kevin Wolf, 2013/10/29