Skip to content

Commit

Permalink
Check and early fail if symbol existance in radiff2-g ##diff
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Jun 20, 2024
1 parent 9a1ce9d commit 8c9bb5b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions libr/main/radiff2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,11 +1288,27 @@ R_API int r_main_radiff2(int argc, const char **argv) {
r_config_set_i (c2->config, "diff.bare", ro.showbare);
r_anal_diff_setup_i (c->anal, ro.diffops, ro.threshold, ro.threshold);
r_anal_diff_setup_i (c2->anal, ro.diffops, ro.threshold, ro.threshold);
if (ro.pdc) {
if (!addr) {
//addr = "entry0";
if (addr) {
bool err = false;
if (r_num_math (c->num, addr) == 0) {
err = true;
} else if (r_num_math (c2->num, addr) == 0) {
err = true;
}
if (err) {
R_LOG_ERROR ("Unknown symbol name '%s'", addr);
return -1;
}
} else {
if (r_num_math (c->num, "main")) {
addr = "main";
} else if (r_num_math (c->num, "entry0")) {
addr = "entry0";
} else {
R_LOG_WARN ("Cannot find entrypoint");
}
}
if (ro.pdc) {
/* should be in mode not in bool pdc */
r_config_set_i (c->config, "scr.color", COLOR_MODE_DISABLED);
r_config_set_i (c2->config, "scr.color", COLOR_MODE_DISABLED);
Expand Down

0 comments on commit 8c9bb5b

Please sign in to comment.