]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - binutils/readelf.c
Fix undefined arithmetic operations detected by -fsanitize=undefined when running...
authorNick Clifton <nickc@redhat.com>
Thu, 26 Feb 2015 14:21:54 +0000 (14:21 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 26 Feb 2015 14:23:27 +0000 (14:23 +0000)
commitc8071705c69a13d237aeca4709bf91deaff7e5cb
treed176a0f3d8569bb1a6a8d05686dbaa878fee1a54
parent03eddd80d7c9b406109c43c07741c9991520954b
Fix undefined arithmetic operations detected by -fsanitize=undefined when running readelf on fuzzed binaries.

PR binutils/17512
* dwarf.c (display_debug_loc): Pacify the undefined behaviour
sanitizer by simplifying address difference calculation.
(struct Frame_Chunk): Change type of cfa_offset to dwarf_vma in
order to avoid arithmetic overflows.
(frame_display_row): Cast cfa_offset before printing it.
(display_debug_frames): Likewise.
Check for an unexpected segment size.
Chnage type of 'l' local to dwarf_vma and cast it back to an int
when printing.
(process_cu_tu_index): Tighten check for an invalid ncols value.
* readelf.c (process_corefile_note_segment): Check for
inote.descdata extending beyond the end of the section.
(process_v850_notes): Likewise.
binutils/ChangeLog
binutils/dwarf.c
binutils/readelf.c