]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
types: add some more error checking
authorNick Alcock <nick.alcock@oracle.com>
Thu, 27 Feb 2025 19:27:00 +0000 (19:27 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Sun, 16 Mar 2025 15:25:28 +0000 (15:25 +0000)
commit456d5bedcccae4ace2b28f4871ebba4cebed8efc
tree2a4664d536172fc24a68f6578719c667ea3655bc
parent648f857144dc6841c0ac6e3b60894389f0aa45a7
types: add some more error checking

A few places with inadequate error checking have fallen out of the
ctf_id_t work:

 - ctf_add_slice doesn't make sure that the type it is slicing
   actually exists
 - ctf_add_member_offset doesn't check that the type of the member
   exists (though it will often fail if it doesn't, it doesn't
   explicitly check, so if you're unlucky it can sometimes succeed,
   giving you a corrupted dict)
 - ctf_type_encoding doesn't check whether its slied type exists:
   it should verify it so it can return a decent error, rather than
   a thoroughly misleading one
 - ctf_type_compat has the same problem with respect to both of its
   arguments. It would definitely be nicer if we could call
   ctf_type_compat and just get a boolean answer, but it's not
   clear to me whether a type can be said to be compatible *or*
   incompatible with a nonexistent one, and we should probably alert
   the users to a likely bug regardless.  C error checking, sigh...
libctf/ctf-create.c
libctf/ctf-types.c