mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
Workaround for MT 06194 (potential segfault during floppy load)
This commit is contained in:
parent
41885e4203
commit
b8c05fd084
@ -412,7 +412,13 @@ bool floppy_image_device::call_load()
|
||||
}
|
||||
|
||||
image = global_alloc(floppy_image(tracks, sides, form_factor));
|
||||
best_format->load(&io, form_factor, image);
|
||||
if (!best_format->load(&io, form_factor, image))
|
||||
{
|
||||
seterror(IMAGE_ERROR_UNSUPPORTED, "Incompatible image format or corrupted data");
|
||||
global_free(image);
|
||||
image = nullptr;
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
output_format = is_readonly() ? nullptr : best_format;
|
||||
|
||||
revolution_start_time = mon ? attotime::never : machine().time();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user