[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH for-2.0 33/47] dmg: prevent out-of-bounds array acc
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-stable] [PATCH for-2.0 33/47] dmg: prevent out-of-bounds array access on terminator |
Date: |
Wed, 26 Mar 2014 13:05:55 +0100 |
When a terminator is reached the base for offsets and sectors is stored.
The following records that are processed will use this base value.
If the first record we encounter is a terminator, then calculating the
base values would result in out-of-bounds array accesses. Don't do
that.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/dmg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/dmg.c b/block/dmg.c
index be2f26e..f4f3e8e 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -182,7 +182,7 @@ static int dmg_open(BlockDriverState *bs, QDict *options,
int flags,
offset += 4;
if (s->types[i] != 0x80000005 && s->types[i] != 1 &&
s->types[i] != 2) {
- if (s->types[i] == 0xffffffff) {
+ if (s->types[i] == 0xffffffff && i > 0) {
last_in_offset = s->offsets[i - 1] + s->lengths[i - 1];
last_out_offset = s->sectors[i - 1] +
s->sectorcounts[i - 1];
--
1.8.5.3
- [Qemu-stable] [PATCH for-2.0 36/47] dmg: sanitize chunk length and sectorcount (CVE-2014-0145), (continued)
- [Qemu-stable] [PATCH for-2.0 36/47] dmg: sanitize chunk length and sectorcount (CVE-2014-0145), Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 32/47] dmg: coding style and indentation cleanup, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 29/47] qcow2: Fix types in qcow2_alloc_clusters and alloc_clusters_noref, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 35/47] dmg: use appropriate types when reading chunks, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 34/47] dmg: drop broken bdrv_pread() loop, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 33/47] dmg: prevent out-of-bounds array access on terminator,
Stefan Hajnoczi <=