Add len check in esil code before calling rz_analysis_op (#3603)

This commit is contained in:
Giovanni 2023-06-25 13:44:02 +08:00 committed by GitHub
parent 8135a450e9
commit d6779c42d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -94,9 +94,9 @@ static int defaultCycles(RzAnalysisOp *op) {
}
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask) {
rz_analysis_op_init(op);
rz_return_val_if_fail(analysis && op && len > 0, -1);
rz_analysis_op_init(op);
int ret = RZ_MIN(2, len);
if (len > 0 && analysis->cur && analysis->cur->op) {
// use core binding to set asm.bits correctly based on the addr

View file

@ -3425,6 +3425,9 @@ RZ_API void rz_core_analysis_esil(RzCore *core, ut64 addr, ut64 size, RZ_NULLABL
rz_analysis_op_fini(&op);
rz_asm_set_pc(core->rasm, cur);
if (i >= iend) {
goto repeat;
}
rz_analysis_op(core->analysis, &op, cur, buf + i, iend - i, RZ_ANALYSIS_OP_MASK_ESIL | RZ_ANALYSIS_OP_MASK_VAL | RZ_ANALYSIS_OP_MASK_HINT);
// if (op.type & 0x80000000 || op.type == 0) {
if (op.type == RZ_ANALYSIS_OP_TYPE_ILL || op.type == RZ_ANALYSIS_OP_TYPE_UNK) {