Skip to content

Commit

Permalink
Check cond, flirt, function and hint APIs nullability for #23490
Browse files Browse the repository at this point in the history
  • Loading branch information
astralia authored Nov 28, 2024
1 parent f4be8ef commit 3315f8e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions libr/anal/cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ R_API const char *r_anal_cond_typeexpr_tostring(int cc) {
}

R_API RAnalCondType r_anal_cond_type_fromstring(const char *type) {
R_RETURN_VAL_IF_FAIL (type, R_ANAL_CONDTYPE_ERR);
int i;
for (i = 0; i < R_ANAL_CONDTYPE_LAST; i++) {
if (!strcmp (type, condtypestr[i])) {
Expand Down
1 change: 1 addition & 0 deletions libr/anal/flirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ static RFlirtNode *flirt_parse(RFlirt *f) {

// if buf is a flirt signature, returns signature version, or zero
R_API int r_sign_is_flirt(RBuffer *buf) {
R_RETURN_VAL_IF_FAIL (buf, 0);
int ret = 0;
idasig_v5_t *header = R_NEW0 (idasig_v5_t);
if (!header) {
Expand Down
3 changes: 3 additions & 0 deletions libr/anal/function.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static void label_addrs_kv_free(HtPPKv *kv) {
}

R_API RAnalFunction *r_anal_function_new(RAnal *anal) {
R_RETURN_VAL_IF_FAIL (anal, NULL);
RAnalFunction *fcn = R_NEW0 (RAnalFunction);
if (!fcn) {
return NULL;
Expand Down Expand Up @@ -316,11 +317,13 @@ R_API ut64 r_anal_function_min_addr(RAnalFunction *fcn) {
}

R_API ut64 r_anal_function_max_addr(RAnalFunction *fcn) {
R_RETURN_VAL_IF_FAIL (fcn, 0);
ensure_fcn_range (fcn);
return fcn->meta._max;
}

R_API ut64 r_anal_function_size_from_entry(RAnalFunction *fcn) {
R_RETURN_VAL_IF_FAIL (fcn, 0);
ensure_fcn_range (fcn);
return fcn->meta._min == UT64_MAX ? 0 : fcn->meta._max - fcn->addr;
}
Expand Down
1 change: 1 addition & 0 deletions libr/anal/hint.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ static void hint_merge(RAnalHint *hint, RAnalAddrHintRecord *record) {
}

R_API RAnalHint *r_anal_hint_get(RAnal *a, ut64 addr) {
R_RETURN_VAL_IF_FAIL (a, NULL);
RAnalHint *hint = R_NEW0 (RAnalHint);
if (!hint) {
return NULL;
Expand Down

0 comments on commit 3315f8e

Please sign in to comment.