libctf: create: don't add forwards if the type added already exists
authorNick Alcock <nick.alcock@oracle.com>
Mon, 21 Oct 2019 10:33:19 +0000 (11:33 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 26 Jun 2020 14:56:39 +0000 (15:56 +0100)
commit6bbf9da8927e848d3d6fdd188ca84385f1dddcce
treee1a74d22ddf3d9960179d6183af26bd8c7aec16a
parentfe4c2d55634c700ba527ac4183e05c66e9f93c62
libctf: create: don't add forwards if the type added already exists

This is what ctf_add_forward is documented to do, but it's not what it
actually does: the code is quite happy to add forwards that duplicate
existing structs, etc.

This is obviously wrong and breaks both the nondeduplicating linker
and the upcoming deduplicator, as well as allowing ordinary callers of
ctf_add_type to corrupt the dictionary by just adding the same root-
visible forward more than once.

libctf/
* ctf-create.c (ctf_add_forward): Don't add forwards to
types that already exist.
libctf/ChangeLog
libctf/ctf-create.c