From 1fcf1bb784796f3a86a4b124aea484cdcb0266e5 Mon Sep 17 00:00:00 2001 From: radare Date: Mon, 24 Dec 2018 11:28:33 +0100 Subject: [PATCH] Fix #12544 - 'jalr t9' is an alias for 'jalr ra ra t9' (#12551) --- libr/asm/arch/mips/mipsasm.c | 11 +++++++++++ libr/core/cconfig.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libr/asm/arch/mips/mipsasm.c b/libr/asm/arch/mips/mipsasm.c index 7d145f30af..aa5d043e15 100644 --- a/libr/asm/arch/mips/mipsasm.c +++ b/libr/asm/arch/mips/mipsasm.c @@ -153,6 +153,17 @@ R_IPI int mips_assemble(const char *str, ut64 pc, ut8 *out) { r_str_replace_char (s, ')', ' '); *out = 0; *w0=*w1=*w2=*w3=0; + + if (!strncmp (s, "jalr", 4) && !strstr (s, ",")) { + char opstr[32]; + const char *arg = strchr (s, ' '); + if (arg) { + snprintf (opstr, sizeof (opstr), "jalr ra ra %s", arg + 1); + free (s); + s = strdup (opstr); + } + } + sscanf (s, "%31s", w0); if (*w0) { for (i = 0; ops[i].name; i++) { diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 20d5264e01..420bd97040 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -264,14 +264,14 @@ static int cb_analmaxrefs(void *user, void *data) { return true; } -static int cb_analnopskip (void *user, void *data) { +static int cb_analnopskip(void *user, void *data) { RCore *core = (RCore*) user; RConfigNode *node = (RConfigNode*) data; core->anal->opt.nopskip = node->i_value; return true; } -static int cb_analhpskip (void *user, void *data) { +static int cb_analhpskip(void *user, void *data) { RCore *core = (RCore*) user; RConfigNode *node = (RConfigNode*) data; core->anal->opt.hpskip = node->i_value;