mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-07 04:57:35 +00:00
Fix #7376 - segfault in dex (thanks to @marcograss for reporting)
This commit is contained in:
parent
22c220c3e2
commit
8bd2882979
@ -2010,6 +2010,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETPREF ("asm.marks", "true", "Show marks before the disassembly");
|
||||
SETPREF ("asm.cmtrefs", "false", "Show flag and comments from refs in disasm");
|
||||
SETPREF ("asm.cmtpatch", "false", "Show patch comments in disasm");
|
||||
SETPREF ("asm.payloads", "false", "Show payload bytes in disasm");
|
||||
SETCB ("bin.strpurge", "false", &cb_strpurge, "Try to purge false positive strings");
|
||||
SETPREF ("bin.libs", "false", "Try to load libraries after loading main binary");
|
||||
n = NODECB ("bin.strfilter", "", &cb_strfilter);
|
||||
|
@ -203,6 +203,7 @@ typedef struct r_disam_options_t {
|
||||
int _tabsoff;
|
||||
bool dwarfFile;
|
||||
bool dwarfAbspath;
|
||||
bool showpayloads;
|
||||
} RDisasmState;
|
||||
|
||||
static void ds_setup_print_pre(RDisasmState *ds, bool tail, bool middle);
|
||||
@ -243,7 +244,7 @@ static void ds_print_fcn_name(RDisasmState *ds);
|
||||
static void ds_print_as_string(RDisasmState *ds);
|
||||
static void ds_print_core_vmode(RDisasmState *ds);
|
||||
static void ds_print_dwarf(RDisasmState *ds);
|
||||
static void ds_print_asmop_payload(RDisasmState *ds);
|
||||
static void ds_print_asmop_payload(RDisasmState *ds, const ut8 *buf);
|
||||
static void ds_print_comments_right(RDisasmState *ds);
|
||||
static void ds_print_ptr(RDisasmState *ds, int len, int idx);
|
||||
|
||||
@ -500,6 +501,8 @@ static RDisasmState * ds_init(RCore *core) {
|
||||
ds->esil_regstate = NULL;
|
||||
ds->esil_likely = false;
|
||||
|
||||
ds->showpayloads = r_config_get_i (ds->core->config, "asm.payloads");
|
||||
|
||||
if (ds->show_flag_in_bytes) {
|
||||
ds->show_flags = 0;
|
||||
}
|
||||
@ -2550,7 +2553,7 @@ static void ds_print_dwarf(RDisasmState *ds) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ds_print_asmop_payload(RDisasmState *ds) {
|
||||
static void ds_print_asmop_payload(RDisasmState *ds, const ut8 *buf) {
|
||||
if (ds->show_varxs) {
|
||||
// XXX asume analop is filled
|
||||
//r_anal_op (core->anal, &ds->analop, ds->at, core->block+i, core->blocksize-i);
|
||||
@ -2572,8 +2575,15 @@ static void ds_print_asmop_payload(RDisasmState *ds) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ds->asmop.payload != 0)
|
||||
if (ds->asmop.payload != 0) {
|
||||
r_cons_printf ("\n; .. payload of %d bytes", ds->asmop.payload);
|
||||
if (ds->showpayloads) {
|
||||
int x;
|
||||
for (x = 0; x < ds->asmop.payload; ++x) {
|
||||
r_cons_printf ("\n 0x%x", buf[ds->oplen + x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* convert numeric value in opcode to ascii char or number */
|
||||
@ -3686,7 +3696,7 @@ toro:
|
||||
ds_print_dwarf (ds);
|
||||
ret = ds_print_middle (ds, ret);
|
||||
|
||||
ds_print_asmop_payload (ds);
|
||||
ds_print_asmop_payload (ds, buf + idx);
|
||||
if (core->assembler->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
RAsmOp ao; /* disassemble for the vm .. */
|
||||
int os = core->assembler->syntax;
|
||||
@ -3760,6 +3770,7 @@ toro:
|
||||
if (inc < 1) {
|
||||
inc = 1;
|
||||
}
|
||||
inc += ds->asmop.payload;
|
||||
}
|
||||
R_FREE (nbuf);
|
||||
r_cons_break_pop ();
|
||||
@ -4226,8 +4237,8 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
|
||||
}
|
||||
|
||||
r_cons_printf ("}");
|
||||
i += oplen; // bytes
|
||||
k += oplen; // delta from addr
|
||||
i += oplen + asmop.payload; // bytes
|
||||
k += oplen + asmop.payload; // delta from addr
|
||||
j++; // instructions
|
||||
line++;
|
||||
|
||||
@ -4493,7 +4504,7 @@ R_API int r_core_print_fcn_disasm(RPrint *p, RCore *core, ut64 addr, int l, int
|
||||
ds_print_color_reset (ds);
|
||||
ds_print_dwarf (ds);
|
||||
ret = ds_print_middle (ds, ret);
|
||||
ds_print_asmop_payload (ds);
|
||||
ds_print_asmop_payload (ds, buf + idx);
|
||||
if (core->assembler->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
RAsmOp ao; /* disassemble for the vm .. */
|
||||
int os = core->assembler->syntax;
|
||||
|
Loading…
Reference in New Issue
Block a user