WEDNESDAY, JULY 1, 2026
libiberty
Fix signed integer overflow in d_compact_number
Corrected a signed integer overflow vulnerability in libiberty's d_compact_number function.
A signed integer overflow vulnerability in the d_compact_number function within GCC’s libiberty library has been fixed. The issue, reported in binutils, is resolved by performing the addition using unsigned arithmetic, which prevents unexpected behavior and potential security risks when formatting numbers.
In Details
The d_compact_number function in libiberty, used for demangling C++ symbols, was susceptible to signed integer overflow. This commit modifies the arithmetic operation to use unsigned integers, mitigating the overflow risk and ensuring correct behavior for large numerical values during the demangling process.
For Context
- libiberty
- A generic library of C routines used by GCC and other GNU projects. It provides common utilities like string manipulation, symbol demangling, and more.
- d_compact_number
- A function within libiberty's C++ symbol demangling code responsible for parsing and formatting compact numerical representations of names.
- Signed integer overflow
- An error condition that occurs when an arithmetic operation attempts to create a value that is too large to be represented within the allocated bits for a signed integer type. This can lead to unpredictable program behavior and security vulnerabilities.