binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libctf

libctf: Bounds-check type records to prevent out-of-bounds reads

libctf now bounds-checks type records to prevent heap out-of-bounds reads and writes.

This commit hardens libctf against malformed type records that could lead to heap out-of-bounds reads and writes. A crafted FUNCTION type record with an excessively large vlen could cause ctf_flip to read past the end of its buffer. Similar over-reads occurred during type counting and size calculation. The changes introduce bounds checks for record headers, extensions, and variable-length data in various functions to prevent these vulnerabilities. Malformed dictionaries are now rejected with ECTF_CORRUPT.

In Details

libctf/ctf-open.c contains functions for parsing and manipulating Common Trace Format (CTF) type information. This change adds bounds checking for ctf_stype_t and ctf_type_t structures, as well as their variable-length data, within ctf_flip, init_static_types_internal, and get_ctt_size_* functions. This addresses heap out-of-bounds read/write vulnerabilities caused by malformed FUNCTION or other type records, particularly when dealing with foreign endianness.

For Context
CTF
Common Trace Format, a standardized way to represent type information for debugging and tracing, often used in conjunction with DWARF.
libctf
A library within binutils for parsing and manipulating CTF data.
heap out-of-bounds read/write
Memory corruption error where a program accesses memory outside the allocated bounds of a heap-allocated object, potentially leading to crashes or security vulnerabilities.
endian
The order in which a machine stores multi-byte data types, such as integers, in memory. Big-endian stores the most significant byte first, while little-endian stores the least significant byte first.
ECTF_CORRUPT
An error code indicating that the CTF data being processed is malformed or corrupted.
Filed Under: libctfsecurityvulnerabilitybounds checking