block/vpc: check that the image has not been truncated
PATCH v2 1/1 block/vpc: check that the image has not been truncated
this adds a check that a dynamic VHD file has not been accidently truncated (e.g. during transfer or upload).
---v1->v2: used the errp argument as Eric suggested
block/vpc.c | 7 +++++++ 1 file changed, 7 insertions(+)
block/vpc.c +7 -0
@@ -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
Signature · 1 line
1.7.9.5
Quoted 9 lines · Peter Lieven
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 <[email protected]>---
v1->v2: used the errp argument as Eric suggestedblock/vpc.c | 7 +++++++ 1 file changed, 7 insertions(+)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Kevin Wolf
AppliedAm 24.10.2013 um 09:16 hat Peter Lieven geschrieben:
Quoted 4 lines
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 <[email protected]>
Thanks, applied to the block branch.
Kevin
Quoted 6 lines · Kevin Wolf
Am 24.10.2013 um 09:16 hat Peter Lieven geschrieben:
Quoted 4 lines
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 <[email protected]>Thanks, applied to the block branch.
Can you have a look at:
block/vpc: fix virtual size for images created with disk2vhd
as well please.
Peter