Skip to content

Commit 04d7fce

Browse files
committed
Fix null deref and output of aezsue
1 parent a5b348c commit 04d7fce

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

librz/arch/il/analysis_il.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void setup_vm_init_state(RzAnalysisILVM *vm, RZ_NULLABLE RzAnalysisILInit
9696
* \return RzAnalysisRzil* a pointer to RzAnalysisILVM instance
9797
*/
9898
RZ_API RZ_OWN RzAnalysisILVM *rz_analysis_il_vm_new(RzAnalysis *a, RZ_NULLABLE RzReg *init_state_reg) {
99-
rz_return_val_if_fail(a, NULL);
99+
rz_return_val_if_fail(a && a->cur && a->cur->il_config, NULL);
100100
RzAnalysisILConfig *config = a->cur->il_config(a);
101101
if (!config) {
102102
return false;
@@ -281,9 +281,9 @@ static RzAnalysisILStepResult analysis_il_vm_step_while(
281281
rz_strbuf_append(&sb, "\n");
282282
il_events(vm->vm, &sb);
283283

284-
rz_cons_printf("0x%llx [", addr);
284+
rz_cons_printf("0x%08" PFMT64x " [", addr);
285285
for (int i = 0; i < op.size; ++i) {
286-
rz_cons_printf("%x", code[i]);
286+
rz_cons_printf("%02x", code[i]);
287287
}
288288
rz_cons_printf("] %s\n%s\n", op.mnemonic, rz_strbuf_get(&sb));
289289
rz_cons_flush();

librz/core/cil.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,10 @@ static bool step_handle_result(RzCore *core, RzAnalysisILStepResult r) {
683683
RZ_LOG_ERROR("RzIL: invalid instruction or lifting not implemented at address 0x%08" PFMT64x "\n",
684684
rz_reg_get_value_by_role(core->analysis->reg, RZ_REG_NAME_PC));
685685
break;
686-
default:
687-
RZ_LOG_ERROR("RzIL: stepping failed.\n");
688-
break;
686+
default: {
687+
ut64 addr = rz_bv_to_ut64(core->analysis->il_vm->vm->pc);
688+
RZ_LOG_ERROR("RzIL: stepping failed with PC at 0x%" PFMT64x ".\n", addr);
689+
} break;
689690
}
690691
return false;
691692
}

librz/include/rz_il/rz_il_opbuilder_begin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
#define MSB(x) rz_il_op_new_msb(x)
139139
#define LSB(x) rz_il_op_new_lsb(x)
140140
#define EQ(x, y) rz_il_op_new_eq(x, y)
141+
#define NE(x, y) rz_il_op_new_ne(x, y)
141142
#define ULT(x, y) rz_il_op_new_ult(x, y)
142143
#define ULE(x, y) rz_il_op_new_ule(x, y)
143144
#define UGT(x, y) rz_il_op_new_ugt(x, y)
@@ -191,6 +192,5 @@
191192
#define BSWAP16(t) rz_il_bswap16(t)
192193
#define BSWAP32(t) rz_il_bswap32(t)
193194
#define BSWAP64(t) rz_il_bswap64(t)
194-
#define NE(x, y) rz_il_op_new_ne(x, y)
195195

196196
#endif

0 commit comments

Comments
 (0)