aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-02-10 17:53:53 +0000
committerNick Clifton <nickc@redhat.com>2015-02-10 17:53:53 +0000
commit834f871cdc6e5d9f5bda9ce607fd3c47f41a2ade (patch)
treec215907e04d8ef3cac4e7c952d817e38a2383fac /binutils/dwarf.c
parent03a91817f163986f10cb843f58e2f2cd9186e4f0 (diff)
downloadgdb-834f871cdc6e5d9f5bda9ce607fd3c47f41a2ade.zip
gdb-834f871cdc6e5d9f5bda9ce607fd3c47f41a2ade.tar.gz
gdb-834f871cdc6e5d9f5bda9ce607fd3c47f41a2ade.tar.bz2
Fix memory access violations discovered by running readelf compiled with 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.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 426dca5..74a5e7a 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -3725,7 +3725,7 @@ display_debug_pubnames_worker (struct dwarf_section *section,
while (start < end)
{
unsigned char *data;
- unsigned long offset;
+ dwarf_vma offset;
unsigned int offset_size, initial_length_size;
data = start;
@@ -3824,11 +3824,11 @@ display_debug_pubnames_worker (struct dwarf_section *section,
kind_name = get_gdb_index_symbol_kind_name (kind);
is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (kind_data);
printf (" %-6lx %s,%-10s %.*s\n",
- offset, is_static ? _("s") : _("g"),
+ (unsigned long) offset, is_static ? _("s") : _("g"),
kind_name, (int) maxprint, data);
}
else
- printf (" %-6lx\t%.*s\n", offset, (int) maxprint, data);
+ printf (" %-6lx\t%.*s\n", (unsigned long) offset, (int) maxprint, data);
data += strnlen ((char *) data, maxprint) + 1;
if (data >= end)