diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-11-26 20:57:45 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-11-26 21:00:36 -0500 |
commit | a35217591dba8840c05937df371d321e3f9cc44f (patch) | |
tree | b4371655c2e1fee393b40d050858bf2a1b478591 | |
parent | 358cdc3cffe4bd9ba7ed5011ff59175b616ef45e (diff) |
dimemory: Reimplement aa0d17757d9e5857bb99887841133045cc530655 correctly; reading past the end of a std::vector is not a good thing to do (nw)
-rw-r--r-- | src/emu/dimemory.cpp | 5 |
1 files 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); } } |