summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-02-19 17:55:21 +0100
committer Olivier Galibert <galibert@pobox.com>2021-02-20 16:08:22 +0100
commitb9511ec83f0bafd9c492f769ce1cf3de4ec37bfd (patch)
tree2f26fe03c93d5cc45a0108ab6eca2b07f95350ef /src/lib
parent155d4487d6afc870bb23a9dec2e31c4177e11420 (diff)
mfi: Don't crash on a fully unformatted disk
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/formats/mfi_dsk.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index df60e5aeec0..049660272a3 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -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;