aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-27Fix compilation with GCC 4.4.7.Jan Kratochvil1-3/+5
binutils/ 2017-02-27 Jan Kratochvil <jan.kratochvil@redhat.com> Fix compilation with GCC 4.4.7. * dwarf.c (display_loclists_list, display_debug_rnglists_list): Initialize begin and end.
2017-02-23DWARF-5: DW_FORM_data16Jan Kratochvil1-0/+26
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (read_and_display_attr_value): Support DW_FORM_data16.
2017-02-23DWARF-5: MacrosJan Kratochvil1-28/+28
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_debug_macro): Support DWARF-5. Rename DW_MACRO_GNU_*.
2017-02-23DWARF-5: call sitesJan Kratochvil1-7/+36
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (decode_location_expression): Support DW_OP_implicit_pointer, DW_OP_const_type, DW_OP_regval_type, DW_OP_deref_type, DW_OP_convert and DW_OP_reinterpret. (read_and_display_attr_value): Support DW_AT_call_value, DW_AT_call_data_value, DW_AT_call_target and DW_AT_call_target_clobbered.
2017-02-23DWARF-5 basic functionalityJan Kratochvil1-204/+956
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (fetch_indirect_line_string): New function. (abbrev_attr): New field implicit_const. (add_abbrev_attr): New parameter implicit_const. (process_abbrev_section): Support DW_FORM_implicit_const. (decode_location_expression): Support DW_OP_entry_value. (read_and_display_attr_value): Add parameter implicit_const. Support DW_FORM_line_strp and DW_FORM_implicit_const. (read_and_display_attr): Add parameter implicit_const. (process_debug_info): Support line_str and DWARF-5. (read_debug_line_header): Support DWARF-5. (display_formatted_table): New function. (display_debug_lines_raw): New parameter file. Support DWARF-5. (display_debug_lines_decoded): New parameter fileptr. Support DWARF-5. (display_debug_lines): Pass file parameter. (display_debug_macro): Update read_and_display_attr_value caller. (display_debug_abbrev): Support DW_FORM_implicit_const. (display_loclists_list): New function. (display_loc_list): Support .debug_loclists. (display_debug_ranges_list): New function from display_debug_ranges. (display_debug_rnglists_list): New function. (display_debug_ranges): Support .debug_rnglists. (debug_displays): Add .debug_line_str, .debug_loclists and .debug_rnglists. * dwarf.h: Include dwarf2.h (DWARF2_Internal_LineInfo): Add li_offset_size. (DWARF2_Internal_CompUnit): Add cu_unit_type. (enum dwarf_section_display_enum): Add line_str. * readelf.c (process_section_headers): Add rnglists and loclists.
2017-02-23DWARF attrs: add delimiterJan Kratochvil1-25/+25
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_block): Add parameter delimiter. (decode_location_expression): Update display_block callers. (read_and_display_attr_value): Add parameter delimiter. (read_and_display_attr, display_debug_macro): Update read_and_display_attr_value caller.
2017-02-23dwarf.c: Use more dwarf_vmaJan Kratochvil1-23/+23
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_loc_list): Use dwarf_vma for offset, base_address and off. (display_loc_list_dwo): Use dwarf_vma for offset. (display_debug_loc): Use dwarf_vma for offset, base_address. (struct range_entry, range_entry_compar): Use dwarf_vma for ranges_offset. (display_debug_ranges): Use dwarf_vma for ranges_offset, offset and base_address.
2017-02-22Display user op byteJan Kratochvil1-2/+2
binutils/ 2017-02-22 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (decode_location_expression): Display also OP.
2017-02-20Fix another memory access error in readelf when parsing a corrupt binary.Nick Clifton1-14/+20
PR binutils/21156 * dwarf.c (cu_tu_indexes_read): Move into... (load_cu_tu_indexes): ... here. Change the variable into tri-state. Change the function into boolean, returning false if the indicies could not be loaded. (find_cu_tu_set): Return NULL if the indicies could not be loaded.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-11-27Fix spelling in comments in C source files (binutils)Ambrogino Modigliani1-2/+2
* dwarf.c: Fix spelling in comments. * dwarf.h: Fix spelling in comments. * objcopy.c: Fix spelling in comments. * od-macho.c: Fix spelling in comments. * rclex.c: Fix spelling in comments. * readelf.c: Fix spelling in comments. * stabs.c: Fix spelling in comments.
2016-10-06-Wimplicit-fallthrough warning fixesAlan Modra1-0/+3
Comment changes. bfd/ * coff-h8300.c: Spell fall through comments consistently. * coffgen.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ppc.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf64-ppc.c: Likewise. * elfxx-aarch64.c: Likewise. * elfxx-mips.c: Likewise. * cpu-ns32k.c: Add missing fall through comments. * elf-m10300.c: Likewise. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-bfin.c: Likewise. * elf32-frv.c: Likewise. * elf32-i386.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-nds32.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-tic6x.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * ieee.c: Likewise. * oasys.c: Likewise. * pdp11.c: Likewise. * srec.c: Likewise. * versados.c: Likewise. opcodes/ * aarch64-opc.c: Spell fall through comments consistently. * i386-dis.c: Likewise. * aarch64-dis.c: Add missing fall through comments. * aarch64-opc.c: Likewise. * arc-dis.c: Likewise. * arm-dis.c: Likewise. * i386-dis.c: Likewise. * m68k-dis.c: Likewise. * mep-asm.c: Likewise. * ns32k-dis.c: Likewise. * sh-dis.c: Likewise. * tic4x-dis.c: Likewise. * tic6x-dis.c: Likewise. * vax-dis.c: Likewise. binutils/ * dlltool.c: Spell fall through comments consistently. * objcopy.c: Likewise. * readelf.c: Likewise. * dwarf.c: Add missing fall through comments. * elfcomm.c: Likewise. * sysinfo.y: Likewise. * readelf.c: Likewise. Also remove extraneous comments. gas/ * app.c: Add missing fall through comments. * dw2gencfi.c: Likewise. * expr.c: Likewise. * config/tc-alpha.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-cr16.c: Likewise. * config/tc-crx.c: Likewise. * config/tc-dlx.c: Likewise. * config/tc-h8300.c: Likewise. * config/tc-hppa.c: Likewise. * config/tc-i370.c: Likewise. * config/tc-i386.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-m68hc11.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-metag.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-ns32k.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-score.c: Likewise. * config/tc-score7.c: Likewise. * config/tc-sh.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-vax.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/tc-z80.c: Likewise. * config/tc-z8k.c: Likewise. * config/obj-elf.c: Likewise. * config/tc-i386.c: Likewise. * depend.c: Spell fall through comments consistently. * config/tc-arm.c: Likewise. * config/tc-d10v.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-mcore.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-ns32k.c: Likewise. * config/tc-visium.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/tc-z8k.c: Likewise. gprof/ * gprof.c: Add missing fall through comments. ld/ * lexsup.c: Spell fall through comments consistently and add missing fall through comments.
2016-09-29Frame info dump: Fix bad register marks.Andreas Krebbel1-10/+23
On S/390 we see quite often registers marked as "bad register" in the readelf --debug-dump=frames or objdump -Wf output. 00000000 0000000000000014 00000000 CIE Version: 1 Augmentation: "zR" Code alignment factor: 1 Data alignment factor: -8 Return address column: 14 Augmentation data: 1b DW_CFA_def_cfa: r15 ofs 160 DW_CFA_nop DW_CFA_nop DW_CFA_nop ... 00000050 000000000000001c 00000054 FDE cie=00000000 pc=0000000080000e58..0000000080000e84 DW_CFA_advance_loc: 6 to 0000000080000e5e DW_CFA_offset: r14 at cfa-48 DW_CFA_offset: r15 at cfa-40 DW_CFA_advance_loc: 6 to 0000000080000e64 DW_CFA_def_cfa_offset: 320 DW_CFA_advance_loc: 18 to 0000000080000e76 DW_CFA_restore: bad register: r15 <------ DW_CFA_restore: r14 DW_CFA_def_cfa_offset: 160 This is triggered by this check in display_debug_frames (dwarf.c): case DW_CFA_restore: if (opa >= (unsigned int) cie->ncols || opa >= (unsigned int) fc->ncols) reg_prefix = bad_reg; cie->ncols is number of registers referenced in the CIE which is 15 due to r14 being given as return address column. So for the CFA_restore of r15 a "bad register" is being printed while the same rule on r14 is ok. The reason for this check is to prevent wild memory accesses when reading input with corrupted register values while accessing the col_type/col_offset arrays. However in that case r15 is a perfectly valid register. It just happens not to be mentioned in the CIE. Hence restoring the CIE rule for r15 should end up with the default rule which is DW_CFA_undefined. This probably wasn't observed on other platforms because they either do not use CFA_restore (x86-64) or do not issue CFA_restore on registers with a higher number than the return address column. binutils/ChangeLog: 2016-09-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * dwarf.c (frame_display_row): Fix formatting of return address register column. (display_debug_frames): Ignore invalid indices into cie->col_type/cie->col_offset arrays and default to DW_CF_undefined instead.
2016-09-29Add .cfi_val_offset GAS command.Andreas Krebbel1-2/+2
This patch adds support for .cfi_val_offset GAS pseudo command which maps to DW_CFA_val_offset and DW_CFA_val_offset_sf. gas/ChangeLog: 2016-09-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * doc/as.texinfo: Add docu for .cfi_val_offset. * dw2gencfi.c (cfi_add_CFA_val_offset): New function. (dot_cfi): Add case for DW_CFA_val_offset. (output_cfi_insn): Likewise. (cfi_pseudo_table): Add entry for cfi_val_offset. * dw2gencfi.h: Add prototype for cfi_add_CFA_val_offset. * testsuite/gas/cfi/cfi-common-8.d: New test. * testsuite/gas/cfi/cfi-common-8.s: New test. * testsuite/gas/cfi/cfi.exp: Run cfi-common-8 testcase. binutils/ChangeLog: 2016-09-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * dwarf.c (display_debug_frames): Adjust output line.
2016-08-08Fix seg-faults when running readelf on fuzzed binaries.Nick Clifton1-4/+27
PR binutils/20440 * dwarf.c (display_debug_lines_decoded): Add checks for running off the end of the section when populating the directory table and file table. (frame_display_row): Set max_regs equal to ncols. (load_specific_debug_section): If the section is compressed, but it is not big enough to hold a compression header then warn and return 0.
2016-08-08Fix seg-fault in DWARF dumper when given a corrupt binary containing illegal ↵Nick Clifton1-17/+55
directory and file table indicies. PR binutils/20439 * dwarf.c (display_debug_lines_decoded): Check directory and file indicies before using them to access directory and file tables.
2016-06-02Fix a bug displaying the interpretation of a CFA block that just contains ↵Nick Clifton1-1/+9
DW_CFA_NOP instructions. * dwarf.c (display_debug_frames): Do not display any interpretation if the block consists solely of DW__CFA_NOPs.
2016-04-13Add init_dwarf_regnames_s390Andreas Arnez1-0/+28
Define and use DWARF register names for s390. binutils/ChangeLog: * dwarf.h (init_dwarf_regnames_s390): Declare. * dwarf.c (dwarf_regnames_s390): New. (init_dwarf_regnames_s390): New. (init_dwarf_regnames): Call it. * objdump.c (dump_dwarf): Likewise.
2016-04-04Ignore DWARF debug information with a version of 0 - assume that it is padding.Nick Clifton1-1/+6
PR 19872 bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised version number if the version is zero. bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised version number if the version is zero.
2016-03-22Fix unbounded stack usage warning inside the SAFE_BYTE_GET macro.Nick Clifton1-1/+6
PR 19851 binutils * dwarf.c (SAFE_BYTE_GET): Replace local dynamic array allocation with run time size check.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-12-08Fix static analysis warning about undefined bheaviour.Nick Clifton1-1/+1
PR binutils/19310 * dwarf.c (display_debug_frames): Recode range test to avoid undefined behaviour.
2015-11-30objdump: Handle 32-bit base address in debug_ranges / debug_loc.Andrew Burgess1-11/+14
When the DWARF address size is 32-bit, but the host machine is 64-bit, objdump fails to spot base addresses specified in the .debug_ranges and .debug_loc lists. As an example, here is the output when dumping an example .debug_ranges section with the pre-patched objdump: Contents of the .debug_ranges section: Offset Begin End 00000000 ffffffff 00000004 (start > end) 00000000 00000000 00000004 00000000 ffffffff 00000008 (start > end) 00000000 00000000 00000004 00000000 <End of list> And this is what the same section looks like when dumped with the patched version of objdump: Contents of the .debug_ranges section: Offset Begin End 00000000 ffffffff 00000004 (base address) 00000000 00000004 00000008 00000000 ffffffff 00000008 (base address) 00000000 00000008 0000000c 00000000 <End of list> binutils/ChangeLog: * dwarf.c (is_max_address): New function. (display_loc_list): Remove out of date comment, use is_max_address. (display_debug_ranges): Likewise. binutils/testsuite/ChangeLog: * binutils-all/objdump.exp: Add test for .debug_ranges decode. * binutils-all/dw2-ranges.S: New file. * binutils-all/dw2-ranges.W: New file.
2015-11-09binutils: Fix left shift of negative value.Dominik Vogt1-1/+1
This patch fixes all occurences of left-shifting negative constants in C code which is undefined by the C standard. binutils/ChangeLog: * dwarf.c (read_leb128): Fix left shift of negative value.
2015-08-12Remove trailing spaces in binutilsH.J. Lu1-1/+1
2015-06-05Improves the detection of partial .debug_line sections.Nick Clifton1-8/+10
* dwarf.c (read_debug_line_header): Use reloc_at to detect incomplete .debug_line headers
2015-05-15Fix PR18374 by making readelf and objdump ignore end-of-list markers in the ↵Nick Clifton1-77/+91
.debug_loc section if there are relocations against them. PR binutils/18374 bin * dwarf.h (struct dwarf_section): Add reloc_info and num_relocs fields. (struct dwarf_section_display): Change bitfield to boolean. (reloc_at): Add prototype. * dwarf.c (display_loc_list): Ignore list terminators if there are relocs against them. (display_debug_loc): Issue a warning if there are relocs against the .debug_loc section. (display_displays): Initialise reloc_info and num_relocs fields. * objdump.c (load_specific_debug_section): Initialise reloc_info and num_relocs fields. (reloc_at): New function. * readelf.c (is_32bit_abs_reloc): Add IA64's R_IA64_DIS32LSB reloc. (reloc_at): New function. (apply_relocations): Add relocs_return and num_relocs_return parameters. Fill them in with the loaded relocs if non-NULL. (dump_section_as_bytes): Update call to apply_relocations. (load_specific_debug_section): Initialise reloc_info and num_relocs fields. tests * binutils-all/pr18374.s: New test file. * binutils-all/readelf.exp: Assemble and run the new test. * binutils-all/readelf.pr18374: Expected output from readelf.
2015-05-11Add init_dwarf_regnames_iamcuH.J. Lu1-1/+32
* dwarf.c (dwarf_regnames_iamcu): New. (init_dwarf_regnames_iamcu): Likewise. (init_dwarf_regnames): Call init_dwarf_regnames_iamcu for EM_IAMCU. * dwarf.h (init_dwarf_regnames_iamcu): New. * objdump.c (dump_dwarf): Call init_dwarf_regnames_iamcu for bfd_arch_iamcu.
2015-05-11Rename EM_486 to EM_IAMCUH.J. Lu1-1/+1
bfd/ * elfcode.h (elf_object_p): Replace EM_486 with EM_IAMCU. binutils/ * dwarf.c (init_dwarf_regnames): Replace EM_486 with EM_IAMCU. * readelf.c (guess_is_rela): Likewise. (dump_relocations): Likewise. (get_machine_name): Likewise. (get_elf_section_flags): Likewise. (process_section_headers): Likewise. (is_32bit_abs_reloc): Likewise. (is_32bit_pcrel_reloc): Likewise. include/elf/ * common.h (EM_486): Renamed to ... (EM_IAMCU): This.
2015-04-30Fix handling of relocs for the MeP target.Nick Clifton1-0/+2
bfd PR 18317 * elf32-mep.c (MEPREL): Use bfd_elf_generic_reloc instead of mep_reloc. (mep_reloc): Delete unused function. bin * readelf.c (get_machine_flags): Add description of MeP flags. tests * binutils-all/objdump.exp (cpus_expected): Add MeP CPU names.
2015-02-26Fix undefined arithmetic operations detected by -fsanitize=undefined when ↵Nick Clifton1-15/+23
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.
2015-02-13Fixes for memory access violations triggered by running readelf on fuzzed ↵Nick Clifton1-2/+15
binaries. PR binutils/17531 * dwarf.c (display_debug_aranges): Add check for an excessive ar_length value. (process_cu_tu_index): Check for a row * columns sum being too large.
2015-02-13Fix mistake in recent code to check for an unterminated leb128 number.Nick Clifton1-1/+1
* dwarf.c (read_leb128): Fix test for shift becoming too large.
2015-02-13binutils/dwarf.c white spaceAlan Modra1-305/+306
The style fix here is for num_units * sizeof * debug_information. * dwarf.c: Formatting, whitespace. (process_debug_info): Style fix.
2015-02-11Fixes for invalid memory accesses triggered by running readelf on fuzzed ↵Nick Clifton1-15/+29
binaries. PR binutils/17531 * dwarf.c (display_debug_pubnames_worker): Work around compiler bug checking address ranges. (display_debug_frames): Likewise. (display_gdb_index): Likewise. (process_cu_tu_index): Add range check on the ncols value.
2015-02-10Fix memory access violations discovered by running readelf compiled with ↵Nick Clifton1-3/+3
undefined memory access sanitization on fuzzed binaries. PR binutils/17531 * dwarf.c (display_debug_pubnames_worker): Use dwarf_vma type for offset. * readelf.c (dump_relocations): Handle printing offsets which are MIN_INT. (process_corefile_note_segment): Add range check of the namesz field.
2015-02-10Fixes for memory access violations triggered by running readelf on fuzzed ↵Nick Clifton1-2/+9
binaries. PR binutils/17531 * dwarf.c (process_debug_info): Zero the debug information array since correct initialisation cannot be relied upon. (process_cu_tu_index): Improve range checks.
2015-02-10Fix memory access violations triggered by running objdump compiled with ↵Nick Clifton1-8/+30
out-of-bounds sanitization checking. PR binutils/17512 * dwarf.c (eh_addr_size): Use an unsigned type. (size_of_encoded_value): Return an unsigned type. (read_leb128): Break if the shift becomes too big. (process_extended_line_op): Do not read the address if the length is too long. (read_cie): Warn and fail if the pointer size or segment size are too big. * dwarf.h (DWARF2_External_LineInfo): Delete unused and incorrect structure definition. (DWARF2_External_PubNames): Likewise. (DWARF2_External_CompUnit): Likewise. (DWARF2_External_ARange): Likewise. (DWARF2_Internal_LineInfo): Use dwarf_vma type for li_prologue_length. (eh_addr_size): Update prototype. * coffcode.h (styp_to_sec_flags): Use an unsigned long type to hold the flag bits. * peXXigen.c (pe_print_reloc): Use unsigned types to hold the size and number of relocs. (pe_print_debugdata): Use a 32-bit aligned buffer to store the codeview record. * versados.c (process_otr): Check the esdid value before using it to access the EDATA.
2015-02-10Recognize new DWARF5/GCC5 DW_LANG constants for Fortran 03 and Fortran 08.Mark Wielaard1-0/+2
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the Fortran 2003 and Fortran 2008 standards. Handle and display both in binutils. binutils/ChangeLog: * dwarf.c (read_and_display_attr_value): Handle DW_LANG_Fortran03 and DW_LANG_Fortran08. include/ChangeLog: * dwarf2.h: Add DW_LANG_Fortran03 and DW_LANG_Fortran08. http://dwarfstd.org/ShowIssue.php?issue=141121.1
2015-02-06Fix memory access violations triggered by processing fuzzed binaries with a ↵Nick Clifton1-3/+18
32-bit version of readelf, compiled on a 64-bit host. PR binutils/17531 * dwarf.c (xcmalloc): Fail if the arguments are too big. (xcrealloc): Likewise. (xcalloc2): Likewise.
2015-02-06Fixes illegal memory accesses triggereb by running a 32-bit binary version ↵Nick Clifton1-4/+7
of objdump compiled on a 64-bit host. PR binutils/17512 * dwarf.c (display_debug_frames): Fix range checks to work on 32-bit binaries complied on a 64-bit host. * peXXigen.c (rsrc_print_resource_entries): Add range check for addresses that wrap around the address space. (rsrc_parse_entry): Likewise.
2015-02-05Don't refer to optarg in dwarf.c functionAlan Modra1-1/+1
This one is passed in optarg as its argument. PR binutils/17926 * dwarf.c (dwarf_select_sections_by_letters): Don't refer to optarg.
2015-02-04More fixes for memory access violations triggered by running readelf on ↵Nick Clifton1-10/+28
fuzzed binaries. PR binutils/17531 * dwarf.c (read_and_display_attr_value): Test for a block length being so long that it wraps around to before the start of the block. (process_debug_info): Test for section_begin wrapping around to before the start of the section. (display_gdb_index): Test for num_cus being so large that the end address wraps around to before the start of the section. (process_cu_tu_index): Test for j being so large that the section index pool wraps around to before the start of the section.
2015-02-03Fix memory access violations triggered by running readelf on fuzzed binaries.Nick Clifton1-6/+24
PR binutils/17531 * dwarf.c (process_debug_info): Add range check. (display_debug_pubnames_worker): Likewise. (display_gdb_index): Fix range check. (process_cu_tu_index): Add range check. * readelf.c (get_data): Change parameter types from size_t to bfd_size_type. Add checks for loss of accuracy when casting from bfd_size_type to size_t. (get_dynamic_data): Likewise. (process_section_groups): Limit number of error messages.
2015-01-12Properly check abbrev sizeH.J. Lu1-4/+5
abbrev_base is independent of abbrev_size. We should use abbrev_base + abbrev_size to check abbrev section size. * dwarf.c (process_debug_info): Properly check abbrev size.
2015-01-12Another fix for memory access errors trigegred by running readelf on a ↵Nick Clifton1-22/+36
corrupt binary. PR binutils/17531 * dwarf.c (display_debug_addr): Use xcalloc to allocate the debug_addr_info array. Check for an address_base that is too large.
2015-01-12More fixes for memory access errors when running readelf on fuzzed binaries.Nick Clifton1-3/+19
PR binutils/17531 * dwarf.c (process_debug_info): Check for abbrev_base being larger than the section size. (process_cu_tu_index): Use xcalloc2 to allocate the CU and TU arrays. (xcalloc2): New function. Like xcalloc, but checks for overflow. * dwarf.h (xcalloc2): Prototype.
2015-01-05More fixes for invalid memory accesses triggered by fuzzed binaries.Nick Clifton1-31/+76
PR binutils/17531 * dwarf.c (alloc_num_debug_info_entries): New variable. (process_debug_info): Set it. Use it to avoid displaying attributes for which there is no info. (display_debug_abbrev): Check that the debug_info_entry index is valid before using it. (display_loc_list_dwo): Likewise. (process_cu_tu_index): Add range check for an overlarge dw_sect value. (free_debug_memory): Reset alloc_num_debug_info_entries. * readelf.c (slurp_ia64_unwind_table): Warn if the reloc could not be indentified. (dynamic_section_mips_val): Warn if the timestamp is invalid. (print_mips_got_entry): Add a data_end parameter. Warn if a read would go beyond the end of the data, and return an error value. (process_mips_specific): Do not read options from beyond the end of the section. Correct code to display optional data at the end of an option. Warn if there are too many GOT symbols. Update calls to print_mips_got_entry, and handle error returns.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-12-24Reverts an "enhancement" made in a previous delta which complained ofNick Clifton1-7/+2
unprocessed augmentation data at the end of a CIE. * dwarf.c (read_cie): Revert check for unused augmentation data - it was bogus.