From 9095ab66a62a820d3a7df6d648e985a4956f6a4f Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 25 Dec 2014 22:47:27 +0100 Subject: [SQUASH ME] block/dmg: be less restrictive on sec cnt check not needed since memset is used instead of buffer. --- block/dmg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/dmg.c b/block/dmg.c index 87f4b9e0da..3160d3a344 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -227,7 +227,9 @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds, s->sectorcounts[i] = buff_read_uint64(buffer, offset); offset += 8; - if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) { + /* all-zeroes sector (type 2) does not need to be "uncompressed" and can + * therefore be unbounded. */ + if (s->types[i] != 2 && s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) { error_report("sector count %" PRIu64 " for chunk %" PRIu32 " is larger than max (%u)", s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX); -- cgit v1.2.1