Skip to content

Commit

Permalink
Check diff APIs nullability for #23490
Browse files Browse the repository at this point in the history
  • Loading branch information
astralia committed Nov 13, 2024
1 parent 95191c4 commit cc04565
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions libr/anal/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ R_API void r_anal_diff_setup_i(RAnal *anal, int doops, int thbb, int thfcn) {

// Fingerprint function basic block
R_API int r_anal_diff_fingerprint_bb(RAnal *anal, RAnalBlock *bb) {
R_RETURN_VAL_IF_FAIL (anal && bb, 0);
RAnalOp *op;
ut8 *buf;
int oplen, idx = 0;

if (!anal) {
return 0;
}
if (anal->cur && anal->cur->fingerprint_bb) {
return (anal->cur->fingerprint_bb (anal, bb));
}
Expand Down Expand Up @@ -97,10 +95,11 @@ static int bb_sort_by_addr(const void *x, const void *y) {
}

R_API size_t r_anal_diff_fingerprint_fcn(RAnal *anal, RAnalFunction *fcn) {
R_RETURN_VAL_IF_FAIL (anal && fcn, 0);
RAnalBlock *bb;
RListIter *iter;

if (anal && anal->cur && anal->cur->fingerprint_fcn) {
if (anal->cur && anal->cur->fingerprint_fcn) {
return (anal->cur->fingerprint_fcn (anal, fcn));
}

Expand All @@ -119,13 +118,11 @@ R_API size_t r_anal_diff_fingerprint_fcn(RAnal *anal, RAnalFunction *fcn) {
}

R_API bool r_anal_diff_bb(RAnal *anal, RAnalFunction *fcn, RAnalFunction *fcn2) {
R_RETURN_VAL_IF_FAIL (anal && fcn && fcn2, false);
RAnalBlock *bb, *bb2, *mbb, *mbb2;
RListIter *iter, *iter2;
double t, ot;

if (!anal || !fcn || !fcn2) {
return false;
}
if (anal->cur && anal->cur->diff_bb) {
return (anal->cur->diff_bb (anal, fcn, fcn2));
}
Expand Down Expand Up @@ -369,8 +366,9 @@ R_API int r_anal_diff_fcn(RAnal *anal, RList *fcns, RList *fcns2) {
}

R_API int r_anal_diff_eval(RAnal *anal) {
if (anal && anal->cur && anal->cur->diff_eval) {
R_RETURN_VAL_IF_FAIL (anal, false);
if (anal->cur && anal->cur->diff_eval) {
return (anal->cur->diff_eval (anal));
}
return true; // XXX: shouldn't this be false?
return false;
}

0 comments on commit cc04565

Please sign in to comment.