diff options
author | Tom Tromey <tromey@adacore.com> | 2020-10-20 10:28:58 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-10-20 10:36:04 -0600 |
commit | a9b45cb77662d0bb8d312140eee94146f34bd3ce (patch) | |
tree | ac3f78889d431f8b80a364f4cb1904199ec6bceb /gas/depend.c | |
parent | e0c45dedd909c7a0a6621bdc9061051c185123bb (diff) | |
download | gdb-a9b45cb77662d0bb8d312140eee94146f34bd3ce.zip gdb-a9b45cb77662d0bb8d312140eee94146f34bd3ce.tar.gz gdb-a9b45cb77662d0bb8d312140eee94146f34bd3ce.tar.bz2 |
Fix undefined behavior in gdbserver
PR gdb/26742 points out some undefined behavior in gdbserver. The bug
is that remove_thread does:
free_one_thread (thread);
if (current_thread == thread)
current_thread = NULL;
However, the equality check is undefined, because "thread" has already
been freed.
This patch fixes the bug by moving the check earlier.
Tested on x86-64 Fedora 32.
2020-10-20 Tom Tromey <tromey@adacore.com>
PR gdb/26742:
* inferiors.cc (remove_thread): Clear current_thread before
freeing the thread.
Diffstat (limited to 'gas/depend.c')
0 files changed, 0 insertions, 0 deletions