Properly check abbrev size
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 12 Jan 2015 21:34:24 +0000 (13:34 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 12 Jan 2015 21:34:24 +0000 (13:34 -0800)
abbrev_base is independent of abbrev_size.  We should use abbrev_base +
abbrev_size to check abbrev section size.

* dwarf.c (process_debug_info): Properly check abbrev size.

binutils/ChangeLog
binutils/dwarf.c

index af7689bf6b1bd68050b14f8adf6b8230cf68f05b..372230ee86f71e798edf1abc2065ec6db9fc20d3 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * dwarf.c (process_debug_info): Properly check abbrev size.
+
 2015-01-12  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/17531
index a7310c892726e574d69d02559c6740e8c9a0d129..d82c89c6bec73e28e8c66b54b7b73bfd5a69ab98 100644 (file)
@@ -2467,10 +2467,11 @@ process_debug_info (struct dwarf_section *section,
              (unsigned long) compunit.cu_abbrev_offset,
              (unsigned long) abbrev_size);
       /* PR 17531: file:4bcd9ce9.  */ 
-      else if (abbrev_base >= abbrev_size)
-       warn (_("Debug info is corrupted, abbrev base (%lx) is larger than abbrev section size (%lx)\n"),
-             (unsigned long) abbrev_base,
-             (unsigned long) abbrev_size);
+      else if ((abbrev_base + abbrev_size)
+              > debug_displays [abbrev_sec].section.size)
+       warn (_("Debug info is corrupted, abbrev size (%lx) is larger than abbrev section size (%lx)\n"),
+             (unsigned long) abbrev_base + abbrev_size,
+             (unsigned long) debug_displays [abbrev_sec].section.size);
       else
        process_abbrev_section
          (((unsigned char *) debug_displays [abbrev_sec].section.start
This page took 0.029513 seconds and 4 git commands to generate.