mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
mfi: Don't crash on a fully unformatted disk
This commit is contained in:
parent
155d4487d6
commit
b9511ec83f
@ -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));
|
io_generic_read(io, &h, 0, sizeof(header));
|
||||||
int resolution = h.cyl_count >> RESOLUTION_SHIFT;
|
int resolution = h.cyl_count >> RESOLUTION_SHIFT;
|
||||||
h.cyl_count &= CYLINDER_MASK;
|
h.cyl_count &= CYLINDER_MASK;
|
||||||
|
|
||||||
io_generic_read(io, &entries, sizeof(header), (h.cyl_count << resolution)*h.head_count*sizeof(entry));
|
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);
|
image->set_form_variant(h.form_factor, h.variant);
|
||||||
|
|
||||||
|
if(!h.cyl_count)
|
||||||
|
return true;
|
||||||
|
|
||||||
std::vector<uint8_t> compressed;
|
std::vector<uint8_t> compressed;
|
||||||
|
|
||||||
entry *ent = entries;
|
entry *ent = entries;
|
||||||
|
Loading…
Reference in New Issue
Block a user