Skip to content

Commit 0dfc461

Browse files
committed
Fix opcode table over-read crash on Windows
m68ki_build_opcode_table() scans past the end of the handler table because the first while loop expects mask 0xff00 as a sentinel, but m68kmake never generates entries with that mask. Add a zero-terminator guard so the loop stops at the end of the table. On Linux/macOS the over-read lands in zero-filled BSS and happens to work. On Windows the read crosses into unmapped memory and crashes with ACCESS_VIOLATION.
1 parent ff38e8c commit 0dfc461

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/musashi/m68k_in.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void m68ki_build_opcode_table(void)
182182
}
183183

184184
ostruct = m68k_opcode_handler_table;
185-
while(ostruct->mask != 0xff00)
185+
while(ostruct->mask != 0xff00 && ostruct->mask != 0)
186186
{
187187
for(i = 0;i < 0x10000;i++)
188188
{

0 commit comments

Comments
 (0)