From b4e395e74e3394c2572f9ba21b926c975d431fb1 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 26 Nov 2018 20:57:45 -0500 Subject: dimemory: Reimplement aa0d17757d9e5857bb99887841133045cc530655 correctly; reading past the end of a std::vector is not a good thing to do (nw) --- src/emu/dimemory.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index d95b650b8ea..fd8d4311a3a 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -94,7 +94,8 @@ void device_memory_interface::interface_config_complete() void device_memory_interface::interface_validity_check(validity_checker &valid) const { // loop over all address spaces - for (int spacenum = 0; spacenum < int(m_address_map.size()); ++spacenum) + const int max_spaces = std::max(m_address_map.size(), m_address_config.size()); + for (int spacenum = 0; spacenum < max_spaces; ++spacenum) { if (space_config(spacenum)) { @@ -104,7 +105,7 @@ void device_memory_interface::interface_validity_check(validity_checker &valid) // let the map check itself addrmap.map_validity_check(valid, spacenum); } - else if (!m_address_map[spacenum].isnull()) + else if (spacenum < int(m_address_map.size()) && !m_address_map[spacenum].isnull()) osd_printf_warning("Map configured for nonexistent memory space %d\n", spacenum); } } -- cgit v1.2.3