summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author firewave <firewave@users.noreply.github.com>2018-01-20 12:47:18 +0100
committer firewave <firewave@users.noreply.github.com>2018-01-20 12:47:18 +0100
commit1978424daaad95cf98b88eb0b62edbe6029ea0cf (patch)
tree6c8c7edbcf8a9909f5e833483484ffc6bf8649ef
parent5e3467af40798318e413e75844f4fbb74ef92f70 (diff)
cdp1879.cpp: fixed Coverity out-of-bounds warnings (nw)
- m_regs seems to be too small since R_CNT_HOURS is 4 and it will access m_regs at + 6 - so index 10 would be out of bounds - device_timer() also checked the alarm latch for the months which is never written and doesn't exist according to the data sheet
-rw-r--r--src/devices/machine/cdp1879.cpp2
-rw-r--r--src/devices/machine/cdp1879.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/devices/machine/cdp1879.cpp b/src/devices/machine/cdp1879.cpp
index c42a6120b4d..6fbc376df28 100644
--- a/src/devices/machine/cdp1879.cpp
+++ b/src/devices/machine/cdp1879.cpp
@@ -70,7 +70,7 @@ void cdp1879_device::device_timer(emu_timer &timer, device_timer_id id, int para
// comparator IRQ
bool new_state = true;
- for (int i = R_CNT_SECONDS; i <= R_CNT_MONTH; i++)
+ for (int i = R_CNT_SECONDS; i <= R_CNT_HOURS; i++)
{
if(m_regs[i] != m_regs[i + 6])
{
diff --git a/src/devices/machine/cdp1879.h b/src/devices/machine/cdp1879.h
index bd87a228b65..ec34704e20f 100644
--- a/src/devices/machine/cdp1879.h
+++ b/src/devices/machine/cdp1879.h
@@ -71,7 +71,7 @@ private:
R_ALM_HOURS
};
- u8 m_regs[10];
+ u8 m_regs[11];
bool m_comparator_state;
// timers