aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-02-10 14:11:00 +0000
committerNick Clifton <nickc@redhat.com>2015-02-10 14:11:00 +0000
commit77ef86547510cee3a2bff27bea9f19f0b2715bae (patch)
treecf37b63c2505ce132ac49d286340751c4caebe7f /binutils/dwarf.h
parentb677c4562dea82ffaf413e7e9311ca4b9c1c6ec6 (diff)
downloadbinutils-77ef86547510cee3a2bff27bea9f19f0b2715bae.zip
binutils-77ef86547510cee3a2bff27bea9f19f0b2715bae.tar.gz
binutils-77ef86547510cee3a2bff27bea9f19f0b2715bae.tar.bz2
Fix memory access violations triggered by running objdump compiled with 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.
Diffstat (limited to 'binutils/dwarf.h')
-rw-r--r--binutils/dwarf.h46
1 files changed, 3 insertions, 43 deletions
diff --git a/binutils/dwarf.h b/binutils/dwarf.h
index 54dcbc7..45f9927 100644
--- a/binutils/dwarf.h
+++ b/binutils/dwarf.h
@@ -25,22 +25,9 @@ typedef unsigned HOST_WIDEST_INT dwarf_size_type;
/* Structure found in the .debug_line section. */
typedef struct
{
- unsigned char li_length [4];
- unsigned char li_version [2];
- unsigned char li_prologue_length [4];
- unsigned char li_min_insn_length [1];
- unsigned char li_default_is_stmt [1];
- unsigned char li_line_base [1];
- unsigned char li_line_range [1];
- unsigned char li_opcode_base [1];
-}
-DWARF2_External_LineInfo;
-
-typedef struct
-{
dwarf_vma li_length;
unsigned short li_version;
- unsigned int li_prologue_length;
+ dwarf_vma li_prologue_length;
unsigned char li_min_insn_length;
unsigned char li_max_ops_per_insn;
unsigned char li_default_is_stmt;
@@ -53,15 +40,6 @@ DWARF2_Internal_LineInfo;
/* Structure found in .debug_pubnames section. */
typedef struct
{
- unsigned char pn_length [4];
- unsigned char pn_version [2];
- unsigned char pn_offset [4];
- unsigned char pn_size [4];
-}
-DWARF2_External_PubNames;
-
-typedef struct
-{
dwarf_vma pn_length;
unsigned short pn_version;
dwarf_vma pn_offset;
@@ -72,15 +50,6 @@ DWARF2_Internal_PubNames;
/* Structure found in .debug_info section. */
typedef struct
{
- unsigned char cu_length [4];
- unsigned char cu_version [2];
- unsigned char cu_abbrev_offset [4];
- unsigned char cu_pointer_size [1];
-}
-DWARF2_External_CompUnit;
-
-typedef struct
-{
dwarf_vma cu_length;
unsigned short cu_version;
dwarf_vma cu_abbrev_offset;
@@ -88,16 +57,7 @@ typedef struct
}
DWARF2_Internal_CompUnit;
-typedef struct
-{
- unsigned char ar_length [4];
- unsigned char ar_version [2];
- unsigned char ar_info_offset [4];
- unsigned char ar_pointer_size [1];
- unsigned char ar_segment_size [1];
-}
-DWARF2_External_ARange;
-
+/* Structure found in .debug_aranges section. */
typedef struct
{
dwarf_vma ar_length;
@@ -207,7 +167,7 @@ typedef struct
}
debug_info;
-extern int eh_addr_size;
+extern unsigned int eh_addr_size;
extern int do_debug_info;
extern int do_debug_abbrevs;