summaryrefslogtreecommitdiffstats
path: root/block/vhdx-log.c
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2015-07-24 10:26:51 -0400
committerKevin Wolf <kwolf@redhat.com>2015-07-27 17:19:06 +0200
commitb15deac79530d818092cb49a8021bcce83d71b5b (patch)
tree65ff5ca823d26ff8b4ef17df58186eb09cb0a01e /block/vhdx-log.c
parent122e7dab8ac549c8c5a9e1e13aa2464190e888de (diff)
downloadhqemu-b15deac79530d818092cb49a8021bcce83d71b5b.zip
hqemu-b15deac79530d818092cb49a8021bcce83d71b5b.tar.gz
block: vpc - prevent overflow if max_table_entries >= 0x40000000
When we allocate the pagetable based on max_table_entries, we multiply the max table entry value by 4 to accomodate a table of 32-bit integers. However, max_table_entries is a uint32_t, and the VPC driver accepts ranges for that entry over 0x40000000. So during this allocation: s->pagetable = qemu_try_blockalign(bs->file, s->max_table_entries * 4); The size arg overflows, allocating significantly less memory than expected. Since qemu_try_blockalign() size argument is size_t, cast the multiplication correctly to prevent overflow. The value of "max_table_entries * 4" is used elsewhere in the code as well, so store the correct value for use in all those cases. We also check the Max Tables Entries value, to make sure that it is < SIZE_MAX / 4, so we know the pagetable size will fit in size_t. Cc: qemu-stable@nongnu.org Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vhdx-log.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud