PR 34342 SIGSEGV libctf/ctf-types.c:1603
Fixes a SIGSEGV in libctf by adding sanity checks for variable length record bytes against type section length.
This patch addresses a SIGSEGV crash within libctf by adding stricter sanity checks in libctf/ctf-open.c. Specifically, it introduces checks to ensure that variable-length record bytes do not exceed the bounds of the type section length during type upgrades and initialization. The changes are applied to both upgrade_types_v1 and init_static_types_internal functions, preventing potential buffer overflows or out-of-bounds reads that could lead to the observed segmentation fault.
- proposer
Submits a patch that adds sanity checks to `libctf/ctf-open.c` to prevent SIGSEGV by validating variable-length record bytes against the type section length.
In Details
This patch targets the libctf library within binutils, specifically addressing a SIGSEGV in ctf-types.c. The issue arises from insufficient validation of variable-length data within CTF (Common Trace Format) type sections. The fix introduces checks in ctf-open.c to ensure that calculated lengths for variable-length records do not exceed the allocated space within the type section, preventing out-of-bounds accesses during type parsing and upgrade operations.
- libctf
- A library within binutils that handles the Common Trace Format (CTF), a compact, C-like type description language used for DWARF debugging information.
- SIGSEGV
- A segmentation fault signal, indicating that a program has attempted to access a memory location that it is not allowed to access.
- CTF
- Common Trace Format, a data description format used in debugging and tracing, designed to be compact and efficient.