From e5c4907791f354da8ebe39100c7dbef7dc349708 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 22 Oct 2023 10:38:48 -0400 Subject: [PATCH] Disallow zero-length regions in ROM definitions and software lists --- hash/amiga_a3000.xml | 8 ++++---- hash/apricot_flop.xml | 28 ++++++++++++++-------------- hash/msx1_cart.xml | 2 +- hash/oric1_cass.xml | 2 +- hash/to7_cass.xml | 2 +- src/emu/softlist_dev.cpp | 2 ++ src/emu/validity.cpp | 2 ++ 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/hash/amiga_a3000.xml b/hash/amiga_a3000.xml index 092ad0d040b..2e3c6ac0f83 100644 --- a/hash/amiga_a3000.xml +++ b/hash/amiga_a3000.xml @@ -70,7 +70,7 @@ SuperKickstart disks, SCSI installation disks and AMIX - + @@ -94,7 +94,7 @@ SuperKickstart disks, SCSI installation disks and AMIX - + @@ -118,7 +118,7 @@ SuperKickstart disks, SCSI installation disks and AMIX - + @@ -148,7 +148,7 @@ SuperKickstart disks, SCSI installation disks and AMIX - + diff --git a/hash/apricot_flop.xml b/hash/apricot_flop.xml index 22105547d86..5808fe6d25b 100644 --- a/hash/apricot_flop.xml +++ b/hash/apricot_flop.xml @@ -199,7 +199,7 @@ license:CC0-1.0 - + @@ -395,7 +395,7 @@ license:CC0-1.0 - + @@ -474,7 +474,7 @@ license:CC0-1.0 ACT - + @@ -498,7 +498,7 @@ license:CC0-1.0 - + @@ -511,7 +511,7 @@ license:CC0-1.0 ACT - + @@ -523,13 +523,13 @@ license:CC0-1.0 - + - + @@ -542,7 +542,7 @@ license:CC0-1.0 ACT - + @@ -554,19 +554,19 @@ license:CC0-1.0 - + - + - + @@ -579,7 +579,7 @@ license:CC0-1.0 ACT - + @@ -603,7 +603,7 @@ license:CC0-1.0 - + @@ -754,7 +754,7 @@ license:CC0-1.0 - + diff --git a/hash/msx1_cart.xml b/hash/msx1_cart.xml index 807673be30c..41f92fee56d 100644 --- a/hash/msx1_cart.xml +++ b/hash/msx1_cart.xml @@ -11090,7 +11090,7 @@ Right/left cursor keys select tape baud rate 1200/2400 respectively. - + diff --git a/hash/oric1_cass.xml b/hash/oric1_cass.xml index 3c7708c172c..e33895e7141 100644 --- a/hash/oric1_cass.xml +++ b/hash/oric1_cass.xml @@ -2755,7 +2755,7 @@ The cassette stops during the game loading - + diff --git a/hash/to7_cass.xml b/hash/to7_cass.xml index f317a574de1..f2e25be8a0e 100644 --- a/hash/to7_cass.xml +++ b/hash/to7_cass.xml @@ -3490,7 +3490,7 @@ Thanks to DCMOTO (http://dcmoto.free.fr) for info! - + diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp index 595e0bb9a73..b65f5f28300 100644 --- a/src/emu/softlist_dev.cpp +++ b/src/emu/softlist_dev.cpp @@ -576,6 +576,8 @@ void software_list_device::internal_validity_check(validity_checker &valid) current_length = ROMREGION_GETLENGTH(romp); if (!data_area_map.emplace(romp->name(), current_length).second) osd_printf_error("%s: %s part %s data area has duplicate name '%s'\n", m_filename, shortname, part.name(), romp->name()); + if (current_length == 0) + osd_printf_error("%s: %s part %s data area '%s' has zero length\n", m_filename, shortname, part.name(), romp->name()); } else if (ROMENTRY_ISFILE(romp)) // if this is a file, make sure it is properly formatted { diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 6b44a324ade..4cb6202b4d9 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -2204,6 +2204,8 @@ void validity_checker::validate_roms(device_t &root) current_length = ROMREGION_GETLENGTH(romp); if (!m_region_map.emplace(fulltag, current_length).second) osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag); + if (current_length == 0) + osd_printf_error("ROM region '%s' has zero length\n", fulltag); } else if (ROMENTRY_ISSYSTEM_BIOS(romp)) // If this is a system bios, make sure it is using the next available bios number {