mfi: Don't crash on a fully unformatted disk

This commit is contained in:
Olivier Galibert 2021-02-19 17:55:21 +01:00
parent 155d4487d6
commit b9511ec83f

View File

@ -115,10 +115,14 @@ bool mfi_format::load(io_generic *io, uint32_t form_factor, const std::vector<ui
io_generic_read(io, &h, 0, sizeof(header));
int resolution = h.cyl_count >> RESOLUTION_SHIFT;
h.cyl_count &= CYLINDER_MASK;
io_generic_read(io, &entries, sizeof(header), (h.cyl_count << resolution)*h.head_count*sizeof(entry));
image->set_form_variant(h.form_factor, h.variant);
if(!h.cyl_count)
return true;
std::vector<uint8_t> compressed;
entry *ent = entries;