diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-03-26 13:05:42 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-04-01 14:19:09 +0200 |
commit | a1b3955c9415b1e767c130a2f59fee6aa28e575b (patch) | |
tree | c4560b854410ca2629eb5f6c2512664fa180d206 /block | |
parent | 24342f2cae47d03911e346fe1e520b00dc2818e0 (diff) |
qcow2: Check backing_file_offset (CVE-2014-0144)
Header, header extension and the backing file name must all be stored in
the first cluster. Setting the backing file to a much higher value
allowed header extensions to become much bigger than we want them to be
(unbounded allocation).
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 7809f5cab4..f0411a9217 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -511,6 +511,12 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, } } + if (header.backing_file_offset > s->cluster_size) { + error_setg(errp, "Invalid backing file offset"); + ret = -EINVAL; + goto fail; + } + if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { |