]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: fix ref leak of names of newly-inserted non-root-visible types binutils-2_37-branch
authorNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jul 2024 11:45:09 +0000 (12:45 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 2 Aug 2024 10:56:42 +0000 (11:56 +0100)
commit0daea2d62ccdcf453d0885571aab1aca05bc847d
tree877a21aa2733f48cf3d6021624b85a8bc9fcc3bf
parent44f1cd7f536f7eeb9440e8c8d81a10adbb16296b
libctf: fix ref leak of names of newly-inserted non-root-visible types

A bug in ctf_dtd_delete led to refs in the string table to the
names of non-root-visible types not being removed when the DTD
was.  This seems harmless, but actually it would lead to a write
down a pointer into freed memory if such a type was ctf_rollback()ed
over and then the dict was serialized (updating all the refs as the
strtab was serialized in turn).

Bug introduced in commit fe4c2d55634c700ba527ac4183e05c66e9f93c62
("libctf: create: non-root-visible types should not appear in name tables")
which is included in binutils 2.35.

libctf/
* ctf-create.c (ctf_dtd_delete): Remove refs for all types
with names, not just root-visible ones.
libctf/ctf-create.c