]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: archive: endianness-flipping and range-checking
authorNick Alcock <nick.alcock@oracle.com>
Wed, 28 May 2025 14:53:52 +0000 (15:53 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 28 May 2025 14:53:52 +0000 (15:53 +0100)
commitb58e5ee6d8933065bf31c95a5fd8ee626eac82e0
treef866e6d2a363d9db6ef609160746cd98410a748f
parent16e0dd9aab73d2ca270c26783cea85e1fdd95256
libctf: archive: endianness-flipping and range-checking

This does endianness-flipping just like CTF dicts, flipping aggressively on
open, taking advantage of the archive's mmapped nature to flip all the size
words before each archive member as well.

The range checking verifies non-overlappingness of archive sections and
non-overrunning: it does not verify that archive members don't overlap,
because any such overlap would almost certainly fail at open time anyway
(due to the prefixed size word if nothing else).

This dug up a bug in v1 archives, where the size word included the length
of *the size word itself*: we correspondingly reduce that size if v1
archives are encountered (and fail if the result underflows).
libctf/ctf-archive.c