Check the abbrev offset found in the .debug_info section before using
authorAndrew Cagney <cagney@redhat.com>
Wed, 26 Nov 1997 12:35:07 +0000 (12:35 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 26 Nov 1997 12:35:07 +0000 (12:35 +0000)
it.

gdb/ChangeLog
gdb/dwarf2read.c

index 4f28b28fc7fddcb22a91fead84ed4af177769316..fd5b76bfdadfcbc58dbb1815cf403a44e4f88ecf 100644 (file)
@@ -1,8 +1,18 @@
+Wed Nov 26 09:59:47 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * dwarf2read.c (struct comp_unit_head): Change length and
+       abbrev_offset fields to unsigned int.
+       (dwarf2_build_psymtabs_hard): Verify length and offset read from
+       .debug_info section.
+
 Mon Nov 24 14:17:02 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
 
        * infcmd.c: export registers_info, for use by other modules.
        * printcmd.c: export output_command, for use by other modules.
        * stack.c: export locals_info and args_info, for use by other modules.
+       * remote.c: export getpkt, putpkt, and fromhex for external use.
+         Make fromhex case-insensative.  New function "remote_console_output"
+         abstracts the acceptance of "O" packets from target.
 
 Mon Nov 24 08:59:28 1997  Andrew Cagney  <cagney@b1.cygnus.com>
 
index a754a84cdcdd7899b40884447ebdf7a2da1f2903..e12953d60e6af98d0e6e66cfb101a3e0c7b3423c 100644 (file)
@@ -147,9 +147,9 @@ static unsigned int dwarf_str_size;
 /* The data in a compilation unit header looks like this.  */
 struct comp_unit_head
   {
-    int length;
+    unsigned int length;
     short version;
-    int abbrev_offset;
+    unsigned int abbrev_offset;
     unsigned char addr_size;
   };
 
@@ -932,6 +932,16 @@ dwarf2_build_psymtabs_hard (objfile, section_offsets, mainline)
          error ("Dwarf Error: wrong version in compilation unit header.");
          return;
        }
+      if (cu_header.abbrev_offset >= dwarf_abbrev_size)
+       {
+         error ("Dwarf Error: bad offset in compilation unit header.");
+         return;
+       }
+      if (cu_header.length > dwarf_abbrev_size - cu_header.abbrev_offset)
+       {
+         error ("Dwarf Error:  bad length in compilation unit header.");
+         return;
+       }
 
       /* Read the abbrevs for this compilation unit into a table */
       dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);