Validate DW_LNE_define_file filename bounds
Binutils readelf now validates filename bounds in DWARF line number information.
The readelf -wL command in Binutils now correctly validates the bounds of filenames specified in DW_LNE_define_file operations within DWARF line number information. This prevents a heap-buffer-overflow vulnerability that occurred when processing malformed DWARF data with no null terminator before the end of the opcode payload.
In Details
In binutils/dwarf.c, the display_debug_lines_decoded function's handling of DW_LNE_define_file opcode data has been corrected. Previously, it used an unbounded strlen to read the filename, which could lead to a heap-buffer-overflow if the string lacked a null terminator within the opcode's data boundaries. The fix adds bounds checking to ensure strlen operates safely within the allocated buffer.
- DWARF
- A debugging data format used by many Unix and Linux systems. It provides detailed information about program variables, functions, and control flow, enabling debuggers to symbolicate execution.
- DW_LNE_define_file
- An opcode within the DWARF debugging information format that defines a source file name. It is part of the line number information section.
- readelf
- A utility that displays information about ELF (Executable and Linkable Format) files, including DWARF debugging information.
- heap-buffer-overflow
- A security vulnerability where a program writes beyond the allocated buffer in the heap memory, potentially corrupting adjacent data or allowing arbitrary code execution.