summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-11-29 14:10:27 +1100
committer Vas Crabb <vas@vastheman.com>2018-11-29 14:10:27 +1100
commitc2dc4316bdfb59972c2d1b204f46f059f898ea0f (patch)
tree8dac044df4a6e9f53af08fd4ae32a46c74405ab6 /src/devices/imagedev
parentb568e6deab3edaea3f4a15a0253ad64fc5a9897b (diff)
(nw) fix stuff:
* Add per-language compiler flag options to help with exotic setups * Get rid of a potention buffer overrun in NuBus image card * CHAR_WIDTH and LONG_WIDTH are preprocessor macros in limits.h with glibc if __GLIBC_USE (IEC_60559_BFP_EXT) is enabled - avoid using them as names * Make formats/upd765_dsk.h slightly safer with defualt initialisers for key format members * Don't rely on random BSS data being zero in imagedev/floppy.cpp
Diffstat (limited to 'src/devices/imagedev')
-rw-r--r--src/devices/imagedev/floppy.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index a18308b5f36..c69e55b7a19 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -252,7 +252,11 @@ void floppy_image_device::set_formats(const floppy_format_type *formats)
{
extension_list[0] = '\0';
fif_list = nullptr;
- for(int cnt=0; formats[cnt]; cnt++)
+ // FIXME: this code previously treated formats as an array, but none of the actual formats in src/lib/formats provide an array - they all just supply a single function pointer
+ // This happens to work by chance if the next poitner-sized piece of BSS data happens to be zero, which it is most of the time.
+ // However, for some reason on a Linux clang 6 build it sometimes isn't, causing a lovely crash here.
+ // If this is supposed to be a nullptr-terminated array of function pointers, the code needs to be changed to better enforce it.
+ for(int cnt=0; /*formats[cnt]*/ !cnt; cnt++)
{
// allocate a new format
floppy_image_format_t *fif = formats[cnt]();