From 32dafd23748604103b31301999711748ad2bc373 Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 10 Oct 2019 12:35:31 +0200 Subject: [PATCH] Fix null deref when building without any assembler plugin --- libr/core/cfile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libr/core/cfile.c b/libr/core/cfile.c index 4fdf0535e6245..8e86387c4e689 100644 --- a/libr/core/cfile.c +++ b/libr/core/cfile.c @@ -9,8 +9,12 @@ static int r_core_file_do_load_for_debug(RCore *r, ut64 loadaddr, const char *filenameuri); static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loadaddr); +static bool __isMips (RAsm *a) { + return a && a->cur && a->cur->arch && strstr (a->cur->arch, "mips"); +} + static void loadGP(RCore *core) { - if (strstr (core->assembler->cur->arch, "mips")) { + if (__isMips (core->assembler)) { ut64 gp = r_num_math (core->num, "loc._gp"); if (!gp || gp == UT64_MAX) { r_config_set (core->config, "anal.roregs", "zero");