Skip to content

Commit 59ff73a

Browse files
authored
prevents BAP from failing when radare2 fails (#1204)
It looks like that radare2 command line interface varies a bit across versions and we certainly shouldn't really fail if the radare2 process has failed. Also, sometimes, radare2 tries to take -isj as the name of the file, instead of the file itself. So I moved it forward. Fixes #1203
1 parent c9980f4 commit 59ff73a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugins/radare2/radare2_main.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ let parse =
4848
to_string @@ member "type" x
4949

5050
let extract_symbols file =
51-
let cmd = sprintf "radare2 %s -2 -q -cisj" file in
51+
let cmd = sprintf "radare2 -2 -q -cisj %s" file in
5252
let input = Unix.open_process_in cmd in
53-
let out = parse@@Yojson.Safe.from_channel input in
53+
let out = try parse@@Yojson.Safe.from_channel input with
54+
| exn ->
55+
warning "failed to extract symbols: %s" (Exn.to_string exn);
56+
[] in
5457
match Unix.close_process_in input with
5558
| Unix.WEXITED 0 -> out
5659
| WEXITED n ->

0 commit comments

Comments
 (0)