yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From e6dafe932ca93e980ae277ad34926385dd78b75f Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Tue, 25 Mar 2014 14:23:35 +0100
0a122b
Subject: [PATCH 28/49] qcow2: Avoid integer overflow in get_refcount (CVE-2014-0143)
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1395753835-7591-29-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: n/a
0a122b
O-Subject: [virt-devel] [EMBARGOED RHEL-7.0 qemu-kvm PATCH 28/48] qcow2: Avoid integer overflow in get_refcount (CVE-2014-0143)
0a122b
Bugzilla: 1079320
0a122b
RH-Acked-by: Jeff Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1079320
0a122b
Upstream status: Embargoed
0a122b
0a122b
This ensures that the checks catch all invalid cluster indexes
0a122b
instead of returning the refcount of a wrong cluster.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block/qcow2-refcount.c |    2 +-
0a122b
 1 files changed, 1 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
0a122b
index 54bcbd1..c08fb08 100644
0a122b
--- a/block/qcow2-refcount.c
0a122b
+++ b/block/qcow2-refcount.c
0a122b
@@ -89,7 +89,7 @@ static int load_refcount_block(BlockDriverState *bs,
0a122b
 static int get_refcount(BlockDriverState *bs, int64_t cluster_index)
0a122b
 {
0a122b
     BDRVQcowState *s = bs->opaque;
0a122b
-    int refcount_table_index, block_index;
0a122b
+    uint64_t refcount_table_index, block_index;
0a122b
     int64_t refcount_block_offset;
0a122b
     int ret;
0a122b
     uint16_t *refcount_block;
0a122b
-- 
0a122b
1.7.1
0a122b