diff options
-rw-r--r-- | block/dmg.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |