Skip to content

Commit

Permalink
Fix io.va being set to true after aaft
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoLCR committed Jan 27, 2021
1 parent 26e8490 commit c53f386
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 5 additions & 3 deletions librz/core/cmd_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,14 @@ static bool cmd_analysis_aaft(RzCore *core) {
RzListIter *it;
RzAnalysisFunction *fcn;
ut64 seek;
const char *io_cache_key = "io.pcache.write";
bool io_cache = rz_config_get_i(core->config, io_cache_key);
if (rz_config_get_i(core->config, "cfg.debug")) {
eprintf("TOFIX: aaft can't run in debugger mode.\n");
return false;
}
const char *io_cache_key = "io.pcache.write";
RzConfigHold *hold = rz_config_hold_new(core->config);
rz_config_hold_i(hold, "io.va", io_cache_key, NULL);
bool io_cache = rz_config_get_i(core->config, io_cache_key);
if (!io_cache) {
// XXX. we shouldnt need this, but it breaks 'rizin -c aaa -w ls'
rz_config_set_i(core->config, io_cache_key, true);
Expand All @@ -888,7 +890,7 @@ static bool cmd_analysis_aaft(RzCore *core) {
}
rz_core_seek(core, seek, true);
rz_reg_arena_pop(core->analysis->reg);
rz_config_set_i(core->config, io_cache_key, io_cache);
rz_config_hold_restore(hold);
free(saved_arena);
return true;
}
Expand Down
13 changes: 13 additions & 0 deletions test/db/cmd/types
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,19 @@ var int64_t canary @ rbp-0x8
EOF
RUN

NAME=aaft io.va side effect
FILE=-
ARGS=-eio.va=0 -a x86 -b 64
CMDS=<<EOF
af
aaft
e io.va
EOF
EXPECT=<<EOF
false
EOF
RUN

NAME=bashbot test (x86_64)
FILE=bins/elf/bashbot.x86_64.O0.elf
CMDS=<<EOF
Expand Down

0 comments on commit c53f386

Please sign in to comment.