From a9ac7c1534c173029cff71887eb5e58a93bf106e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 26 Nov 2014 08:50:30 -0500 Subject: [PATCH] SAGE: Fix loop bounds in m68k_cpu cache_line has a size of CACHE_SIZE (16), so starting at that index will be outside the bounds of the array. --- SAGE/m68k_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SAGE/m68k_cpu.c b/SAGE/m68k_cpu.c index c759185d..3cb8c906 100644 --- a/SAGE/m68k_cpu.c +++ b/SAGE/m68k_cpu.c @@ -274,7 +274,7 @@ static t_stat ReadICache(t_addr tpc) /* 68000/08/10 do not like unaligned access */ if (cputype < 3 && (tpc & 1)) return STOP_ERRADR; - for (i=CACHE_SIZE; i>=0; i--) { + for (i=CACHE_SIZE-1; i>=0; i--) { cache_line[i] = *mem--; } // for (i=0; i<16; i++) printf("icache[%d]=0x%08x\n",i,cache_line[i]);