AltairZ80: fix out-of-bounds accesses (Coverity Scan)
This commit is contained in:
parent
ba527ab24a
commit
e49f06dcc3
1 changed files with 4 additions and 4 deletions
|
@ -373,7 +373,7 @@ unsigned int m68k_cpu_read_word(unsigned int address) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (address > M68K_MAX_RAM) {
|
if (address > M68K_MAX_RAM-1) {
|
||||||
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
||||||
sim_printf("M68K: 0x%08x Attempt to read word from non existing memory 0x%08x." NLP,
|
sim_printf("M68K: 0x%08x Attempt to read word from non existing memory 0x%08x." NLP,
|
||||||
PCX, address);
|
PCX, address);
|
||||||
|
@ -391,7 +391,7 @@ unsigned int m68k_cpu_read_long(unsigned int address) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (address > M68K_MAX_RAM) {
|
if (address > M68K_MAX_RAM-3) {
|
||||||
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
||||||
sim_printf("M68K: 0x%08x Attempt to read long from non existing memory 0x%08x." NLP,
|
sim_printf("M68K: 0x%08x Attempt to read long from non existing memory 0x%08x." NLP,
|
||||||
PCX, address);
|
PCX, address);
|
||||||
|
@ -433,7 +433,7 @@ void m68k_cpu_write_byte(unsigned int address, unsigned int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void m68k_cpu_write_word(unsigned int address, unsigned int value) {
|
void m68k_cpu_write_word(unsigned int address, unsigned int value) {
|
||||||
if (address > M68K_MAX_RAM) {
|
if (address > M68K_MAX_RAM-1) {
|
||||||
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
||||||
sim_printf("M68K: 0x%08x Attempt to write word 0x%04x to non existing memory 0x%08x." NLP,
|
sim_printf("M68K: 0x%08x Attempt to write word 0x%04x to non existing memory 0x%08x." NLP,
|
||||||
PCX, value & 0xffff, address);
|
PCX, value & 0xffff, address);
|
||||||
|
@ -483,7 +483,7 @@ void m68k_cpu_write_long(unsigned int address, unsigned int value) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (address > M68K_MAX_RAM) {
|
if (address > M68K_MAX_RAM-3) {
|
||||||
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
if (cpu_unit.flags & UNIT_CPU_VERBOSE)
|
||||||
sim_printf("M68K: 0x%08x Attempt to write long 0x%08x to non existing memory 0x%08x." NLP,
|
sim_printf("M68K: 0x%08x Attempt to write long 0x%08x to non existing memory 0x%08x." NLP,
|
||||||
PCX, value, address);
|
PCX, value, address);
|
||||||
|
|
Loading…
Add table
Reference in a new issue