libctf: Sanitize error types for PR 30836
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Wed, 13 Sep 2023 09:02:36 +0000 (11:02 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Tue, 17 Oct 2023 15:31:20 +0000 (17:31 +0200)
commit998a4f589d68503f79695f180fdf1742eeb0a39d
tree618e2906f5b949c620ddba79664f7f32a14d25bc
parent22bfda88f898e8ce11a622a888bd3f1daf86114a
libctf: Sanitize error types for PR 30836

Made sure there is no implicit conversion between signed and unsigned
return value for functions setting the ctf_errno value.
An example of the problem is that in ctf_member_next, the "offset" value
is either 0L or (ctf_id_t)-1L, but it should have been 0L or -1L.
The issue was discovered while building a 64 bit ld binary to be
executed on the Windows platform.
Example object file that demonstrates the issue is attached in the PR.

libctf/
Affected functions adjusted.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
libctf/ctf-create.c
libctf/ctf-dedup.c
libctf/ctf-impl.h
libctf/ctf-inlines.h
libctf/ctf-link.c
libctf/ctf-lookup.c
libctf/ctf-types.c
libctf/ctf-util.c