aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorJan Vrany <jan.vrany@labware.com>2022-12-12 13:16:14 +0000
committerJan Vrany <jan.vrany@labware.com>2022-12-12 13:16:14 +0000
commitb5661ff24f7111246b9e9b5f1cba5afe9d479daf (patch)
treeaaaf78e1340fc169c3e153358483c31b42d58457 /binutils/dwarf.c
parenta28fedbc3f582ce7c8bad2eb017b1dc072bb1da7 (diff)
downloadgdb-b5661ff24f7111246b9e9b5f1cba5afe9d479daf.zip
gdb-b5661ff24f7111246b9e9b5f1cba5afe9d479daf.tar.gz
gdb-b5661ff24f7111246b9e9b5f1cba5afe9d479daf.tar.bz2
gdb: fix possible use-after-free when executing commands
In principle, `execute_command()` does following: struct cmd_list_element *c; c = lookup_cmd ( ... ); ... /* If this command has been pre-hooked, run the hook first. */ execute_cmd_pre_hook (c); ... /* ...execute the command `c` ...*/ ... execute_cmd_post_hook (c); This may lead into use-after-free error. Imagine the command being executed is a user-defined Python command that redefines itself. In that case, struct `cmd_list_element` pointed to by `c` is deallocated during its execution so it is no longer valid when post hook is executed. To fix this case, this commit looks up the command once again after it is executed to get pointer to (possibly newly allocated) `cmd_list_element`.
Diffstat (limited to 'binutils/dwarf.c')
0 files changed, 0 insertions, 0 deletions