Skip to content

Commit

Permalink
fix core_disassembly when n_bytes==0
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Nov 5, 2024
1 parent 3840931 commit 7727496
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions librz/core/cmd/cmd_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -3218,6 +3218,11 @@ static void disassembly_as_table(RzTable *t, RzCore *core, ut64 addr, int n_inst
static bool core_disassembly(RzCore *core, int n_bytes, int n_instrs, RzCmdStateOutput *state, bool cbytes) {
ut64 offset = rz_core_backward_offset(core, core->offset, &n_instrs, &n_bytes);

if (n_bytes == 0) {
const int max_op_size = rz_analysis_archinfo(core->analysis, RZ_ANALYSIS_ARCHINFO_MAX_OP_SIZE);
n_bytes = max_op_size * n_instrs;
}

RZ_LOG_VERBOSE("disassembly at: 0x%" PFMT64x " "
"blocksize: %" PFMT32d " "
"n_bytes: %" PFMT32d " "
Expand All @@ -3226,6 +3231,7 @@ static bool core_disassembly(RzCore *core, int n_bytes, int n_instrs, RzCmdState
RzCoreDisasmOptions disasm_options = {
.cbytes = cbytes,
};

ut8 *buf = malloc(n_bytes + 1);
if (!buf) {
RZ_LOG_ERROR("Failed to allocate memory\n");
Expand Down

0 comments on commit 7727496

Please sign in to comment.