Added asserts for index out of bounds (#3017)

* acia.cpp: added asserts for index out of bounds with e.g. mushi2k4

../../../../../src/devices/sound/aica.cpp:996:40: runtime error: index 130 out of bounds for type 'uint16_t [128]'
../../../../../src/devices/sound/aica.cpp:916:37: runtime error: index 130 out of bounds for type 'uint16_t [128]'
../../../../../src/devices/sound/aica.cpp:978:42: runtime error: index 224 out of bounds for type 'uint8_t [192]'

* k054156_k054157_k056832.cpp: added assert for index out of bounds with ddboy (nw)

../../../../../src/mame/video/k054156_k054157_k056832.cpp:1152:2: runtime error: index 5 out of bounds for type 'uint16_t [4]'
../../../../../src/mame/video/k054156_k054157_k056832.cpp:1152:2: runtime error: index 5 out of bounds for type 'uint16_t [4]'

* vis.cpp: added assert for index out of bounds with vis (nw)

../../../../../src/mame/drivers/vis.cpp:538:4: runtime error: index 49 out of bounds for type 'uint8_t [49]'

* hp1ll3.cpp: added assert for index out of bounds with hp_ipc (nw)

../../../../../src/devices/video/hp1ll3.cpp:557:5: runtime error: index 11 out of bounds for type 'uint16_t [11]'
../../../../../src/devices/video/hp1ll3.cpp:555:5: runtime error: index 11 out of bounds for type 'uint16_t [11]'
This commit is contained in:
Oliver Stöneberg 2018-01-06 10:52:45 +01:00 committed by Vas Crabb
parent eab5e7e116
commit b2ac68ec1c
4 changed files with 10 additions and 0 deletions

View File

@ -913,7 +913,10 @@ void aica_device::w16(address_space &space,unsigned int addr,unsigned short val)
if(addr<0x3200) //COEF
*((unsigned short *) (m_DSP.COEF+(addr-0x3000)/2))=val;
else if(addr<0x3400)
{
assert(((addr-0x3200)/2) < ARRAY_LENGTH(m_DSP.MADRS));
*((unsigned short *) (m_DSP.MADRS+(addr-0x3200)/2))=val;
}
else if(addr<0x3c00)
{
*((unsigned short *) (m_DSP.MPRO+(addr-0x3400)/2))=val;
@ -975,6 +978,7 @@ unsigned short aica_device::r16(address_space &space, unsigned int addr)
else if (addr < 0x28be)
{
UpdateRegR(space, addr&0xff);
assert((addr&0xff) < ARRAY_LENGTH(m_udata.datab));
v= *((unsigned short *) (m_udata.datab+((addr&0xff))));
if((addr&0xfffe)==0x2810) m_udata.data[0x10/2] &= 0x7FFF; // reset LP on read
}
@ -993,7 +997,10 @@ unsigned short aica_device::r16(address_space &space, unsigned int addr)
if(addr<0x3200) //COEF
v= *((unsigned short *) (m_DSP.COEF+(addr-0x3000)/2));
else if(addr<0x3400)
{
assert(((addr-0x3200)/2) < ARRAY_LENGTH(m_DSP.MADRS));
v= *((unsigned short *) (m_DSP.MADRS+(addr-0x3200)/2));
}
else if(addr<0x3c00)
v= *((unsigned short *) (m_DSP.MPRO+(addr-0x3400)/2));
else if(addr<0x4000)

View File

@ -551,6 +551,7 @@ WRITE8_MEMBER( hp1ll3_device::write )
switch (m_command)
{
case CONF:
assert((m_conf_ptr >> 1) < ARRAY_LENGTH(m_conf));
if (m_conf_ptr & 1) {
m_conf[m_conf_ptr >> 1] |= data;
} else {

View File

@ -535,6 +535,7 @@ WRITE8_MEMBER(vis_vga_device::vga_w)
break;
case 0x05:
case 0x25:
assert(vga.crtc.index < ARRAY_LENGTH(m_crtc_regs));
m_crtc_regs[vga.crtc.index] = data;
switch(vga.crtc.index)
{

View File

@ -1149,6 +1149,7 @@ WRITE32_MEMBER( k056832_device::long_w )
WRITE16_MEMBER( k056832_device::b_word_w )
{
assert(offset < ARRAY_LENGTH(m_regsb));
COMBINE_DATA(&m_regsb[offset]);
}