]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Some minor cleanups in two-level line table support.
authorCary Coutant <ccoutant@google.com>
Wed, 28 Jan 2015 19:22:01 +0000 (11:22 -0800)
committerCary Coutant <ccoutant@google.com>
Wed, 28 Jan 2015 19:22:01 +0000 (11:22 -0800)
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.

binutils/dwarf.c

index b666ae940654d21c8765d387f35c31cd54f31378..f418cb118a80f7c5cd6561e8ecf6baa3a890a047 100644 (file)
@@ -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)"));