mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 05:40:10 +00:00
Fix crash in m68k capstone disassembler
This commit is contained in:
parent
a7230ca359
commit
42ce366601
24
shlr/capstone-patches/fix-m68k-oob.patch
Normal file
24
shlr/capstone-patches/fix-m68k-oob.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/arch/M68K/M68KInstPrinter.c b/arch/M68K/M68KInstPrinter.c
|
||||
index c545115..aec6a05 100644
|
||||
--- a/arch/M68K/M68KInstPrinter.c
|
||||
+++ b/arch/M68K/M68KInstPrinter.c
|
||||
@@ -28,7 +28,8 @@
|
||||
#ifndef CAPSTONE_DIET
|
||||
static const char* s_spacing = " ";
|
||||
|
||||
-static const char* s_reg_names[] = {
|
||||
+#define S_REG_NAMES_COUNT 47
|
||||
+static const char* s_reg_names[S_REG_NAMES_COUNT] = {
|
||||
"invalid",
|
||||
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
|
||||
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
|
||||
@@ -326,6 +327,9 @@ const char* M68K_reg_name(csh handle, unsigned int reg)
|
||||
#ifdef CAPSTONE_DIET
|
||||
return NULL;
|
||||
#else
|
||||
+ if (reg >= S_REG_NAMES_COUNT) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
return s_reg_names[(int)reg];
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue
Block a user