[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/27] qcow2: Reject too large header extensions
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 16/27] qcow2: Reject too large header extensions |
Date: |
Wed, 29 Feb 2012 16:17:57 +0100 |
Image files that make qemu-img info read several gigabytes into the
unknown header extensions list are bad. Just fail opening the image
if an extension claims to be larger than the header extension area.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
block/qcow2.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index f68f0e1..eb5ea48 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -108,6 +108,11 @@ static int qcow2_read_extensions(BlockDriverState *bs,
uint64_t start_offset,
#ifdef DEBUG_EXT
printf("ext.magic = 0x%x\n", ext.magic);
#endif
+ if (ext.len > end_offset - offset) {
+ error_report("Header extension too large");
+ return -EINVAL;
+ }
+
switch (ext.magic) {
case QCOW2_EXT_MAGIC_END:
return 0;
--
1.7.6.5
- [Qemu-devel] [PULL 00/27] Block patches, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 04/27] fdc: handle read-only floppies (abort early on write commands), Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 03/27] fdc: most control commands do not generate interrupts, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 08/27] fdc: check if media rate is correct before doing any transfer, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 09/27] fdc: fix seek command, which shouldn't check tracks, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 02/27] fdc: set busy bit when starting a command, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 12/27] qcow2: Fix build with DEBUG_EXT enabled, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 18/27] QMP: Add qmp command for blockdev-group-snapshot-sync, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 01/27] fdc: take side count into account, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 10/27] fdc: DIR (Digital Input Register) should return status of current drive..., Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 16/27] qcow2: Reject too large header extensions,
Kevin Wolf <=
- [Qemu-devel] [PATCH 14/27] block: drop aio_multiwrite in BlockDriver, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 11/27] ide: fail I/O to empty disk, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 22/27] qemu-iotests: Filter out DOS line endings, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 13/27] block: remove unused fields in BlockDriverState, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 15/27] qcow2: Fix offset in qcow2_read_extensions, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 06/27] block: add a transfer rate for floppy types, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 07/27] fdc: add a 'check media rate' property. Not used yet, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 19/27] qemu-iotests: export TEST_DIR for non-bash tests, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 27/27] qemu-img: fix segment fault when the image format is qed, Kevin Wolf, 2012/02/29
- [Qemu-devel] [PATCH 05/27] fdc: add CCR (Configuration Control Register) write register, Kevin Wolf, 2012/02/29