summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/upd765_dsk.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2016-05-01 10:26:28 -0400
committer AJR <ajrhacker@users.noreply.github.com>2016-05-01 10:26:28 -0400
commitb8c05fd084db5606b687955c142dee3bb7689994 (patch)
tree7ce61be062d16be24977893945ffaa009c9c7e2a /src/lib/formats/upd765_dsk.cpp
parent41885e420393fba2ab43c5bb0adfedb4c777f769 (diff)
Workaround for MT 06194 (potential segfault during floppy load)
Diffstat (limited to 'src/lib/formats/upd765_dsk.cpp')
-rw-r--r--src/lib/formats/upd765_dsk.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index d9da1c5bd21..97d0daa7d6a 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -180,7 +180,13 @@ bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
if(type == -1)
return false;
+ // format shouldn't exceed image geometry
const format &f = formats[type];
+ int img_tracks, img_heads;
+ image->get_maximal_geometry(img_tracks, img_heads);
+ if (f.track_count > img_tracks || f.head_count > img_heads)
+ return false;
+
floppy_image_format_t::desc_e *desc;
int current_size;
int end_gap_index;