summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-01-25 09:50:20 +0100
committer Vas Crabb <vas@vastheman.com>2021-01-25 21:40:13 +1100
commit0c5e9a05600f1628495ca43832bddc02053bb928 (patch)
treee9c26b616234e3a7d77dd662b9bdac67306d7034
parent722f0a9739a950a5448ed862d4b5f0523ad4e6d6 (diff)
floppy: When the floppy head stays on an unformatted track from more than an hour and ten minutes and reading happens then interval_index*2+1 overflows. Wow. Found and tracked down by Colin Howell, with much thanks.
-rw-r--r--src/devices/imagedev/floppy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index c0b459de665..6d87751280e 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -932,7 +932,7 @@ attotime floppy_image_device::get_next_transition(const attotime &from_when)
return cache_end_time;
// Put a flux transition in the middle of a 4us interval with a 50% probability
- int interval_index = (from_when - cache_weak_start).as_ticks(250000);
+ int64_t interval_index = (from_when - cache_weak_start).as_ticks(250000);
if(interval_index < 0)
interval_index = 0;
attotime weak_time = cache_weak_start + attotime::from_ticks(interval_index*2+1, 500000);