]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: Stop exec_close looking like a UAF weakness
authorGuinevere Larsen <guinevere@redhat.com>
Tue, 29 Apr 2025 14:39:56 +0000 (11:39 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Wed, 30 Apr 2025 12:15:32 +0000 (09:15 -0300)
commitaab91c55c3371b459f923138f2a910e0d223f229
tree9a8752d3be1f2eeac86cb35f0f577a735338f745
parent0ecc474b769473cb0b402e6a1e1d9788f9d538ac
gdb: Stop exec_close looking like a UAF weakness

A recent static analyzer run flagged that program_space::exec_close
could be using a pointer after it has been freed. This is not true, as
the pointer is never dereferenced, the address is used for comparisons.

However, to avoid false positives from static analyzers (or bogus
security bugs), this commit makes the code stop looking like a UAF by
moving the unique_ptr into a local unique_ptr, so that there is no way
someone would think memory could be used after being freed.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/progspace.c