summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2015-01-28 11:22:01 -0800
committerCary Coutant <ccoutant@google.com>2015-01-28 11:22:01 -0800
commitd4c40a8552466864602b548ec424cc2dc2d1c89e (patch)
tree5b62eb0dca05b4e6d3a5f8ee006f9e98ea1a9c7f
parentf7318adf46dfee58ee4fe97799c304dfe73feda3 (diff)
downloadbinutils-gdb-d4c40a8552466864602b548ec424cc2dc2d1c89e.tar.gz
Some minor cleanups in two-level line table support.
2015-01-28 Cary Coutant <ccoutant@google.com> binutils/ * dwarf.c (free_logicals): Set logicals_table to NULL. (fetch_indirect_string): Correct boundary check. (fetch_indirect_line_string): Likewise. (fetch_indexed_string): Likewise. (display_dir_file_table_v5): Print unsigned value.
-rw-r--r--binutils/dwarf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index b666ae94065..f418cb118a8 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -424,6 +424,7 @@ free_logicals (void)
free (logicals_table);
logicals_allocated = 0;
logicals_count = 0;
+ logicals_table = NULL;
}
static void
@@ -643,7 +644,7 @@ fetch_indirect_string (dwarf_vma offset)
if (section->start == NULL)
return (const unsigned char *) _("<no .debug_str section>");
- if (offset > section->size)
+ if (offset >= section->size)
{
warn (_("DW_FORM_strp offset too big: %s\n"),
dwarf_vmatoa ("x", offset));
@@ -661,7 +662,7 @@ fetch_indirect_line_string (dwarf_vma offset)
if (section->start == NULL)
return (const unsigned char *) _("<no .debug_line_str section>");
- if (offset > section->size)
+ if (offset >= section->size)
{
warn (_("DW_FORM_line_strp offset too big: %s\n"),
dwarf_vmatoa ("x", offset));
@@ -688,7 +689,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
if (this_set != NULL)
index_offset += this_set->section_offsets [DW_SECT_STR_OFFSETS];
- if (index_offset > index_section->size)
+ if (index_offset + offset_size > index_section->size)
{
warn (_("DW_FORM_GNU_str_index offset too big: %s\n"),
dwarf_vmatoa ("x", index_offset));
@@ -701,7 +702,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
str_offset = byte_get (index_section->start + index_offset, offset_size);
str_offset -= str_section->address;
- if (str_offset > str_section->size)
+ if (str_offset >= str_section->size)
{
warn (_("DW_FORM_GNU_str_index indirect offset too big: %s\n"),
dwarf_vmatoa ("x", str_offset));
@@ -3031,7 +3032,7 @@ display_dir_file_table_v5 (unsigned char *start, unsigned char *end,
case DW_FORM_udata:
val = read_uleb128 (data, & bytes_read, end);
data += bytes_read;
- printf ("\t%d", val);
+ printf ("\t%u", val);
break;
default:
printf ("\t%s", _("(unrecognized FORM code)"));