Check the external compression header size
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 29 Aug 2016 15:49:20 +0000 (08:49 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 29 Aug 2016 15:49:20 +0000 (08:49 -0700)
Since the internal compression header size can be bigger than the
external compression header size, we should check the external
compression header size.

* readelf.c (load_specific_debug_section): Check the external
compression header size.

binutils/ChangeLog
binutils/readelf.c

index e709a2d42792b5d933eaab6439eae58b75b1b7ad..5ab28f8079bd98048eefe35211ffe9aa987d6512 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * readelf.c (load_specific_debug_section): Check the external
+       compression header size.
+
 2016-08-19  Nick Clifton  <nickc@redhat.com>
 
        * testsuite/binutils-all/readelf.s: Adjust expected ordering of
@@ -17,9 +22,9 @@
        off the end of the section when populating the directory table and
        file table.
        (frame_display_row): Set max_regs equal to ncols.
-       (load_specific_debug_section): If the section is compressed, but
-       it is not big enough to hold a compression header then warn and
-       return 0.
+       * readelf.c (load_specific_debug_section): If the section is
+       compressed, but it is not big enough to hold a compression
+       header then warn and return 0.
 
        PR binutils/20439
        * dwarf.c (display_debug_lines_decoded): Check directory and file
index adbee937caab1fa132e03932c1d8f04415ca32de..a99c521c123541aa99a0857bcbd5c76181e94d7d 100644 (file)
@@ -12706,7 +12706,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
          Elf_Internal_Chdr chdr;
          unsigned int compression_header_size;
 
-         if (size < sizeof chdr)
+         if (size < (is_32bit_elf
+                     ? sizeof (Elf32_External_Chdr)
+                     : sizeof (Elf64_External_Chdr)))
            {
              warn (_("compressed section %s is too small to contain a compression header"),
                    section->name);
This page took 0.036781 seconds and 4 git commands to generate.