[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation |
Date: |
Wed, 14 Nov 2012 19:47:03 +0100 |
A missing factor for the refcount table entry size in the calculation
could mean that too little memory was allocated for the in-memory
representation of the table, resulting in a buffer overflow.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Michael Tokarev <address@hidden>
Tested-by: Michael Tokarev <address@hidden>
---
block/qcow2-refcount.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 5e3f915..96224d1 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -301,7 +301,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
uint64_t last_table_size;
uint64_t blocks_clusters;
do {
- uint64_t table_clusters = size_to_clusters(s, table_size);
+ uint64_t table_clusters =
+ size_to_clusters(s, table_size * sizeof(uint64_t));
blocks_clusters = 1 +
((table_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters);
--
1.7.6.5
- [Qemu-devel] [PULL 00/26] Block patches, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation,
Kevin Wolf <=
- [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo(), Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers, Kevin Wolf, 2012/11/14
- [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command, Kevin Wolf, 2012/11/14