aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-08-29 08:49:20 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-08-29 08:49:20 -0700
commitf53be9779bb1220f33a8a45615e0fafd7b6f47c4 (patch)
tree820183249c1733f2cfed35cbf457f1fe4b7257b3 /binutils/readelf.c
parent74437ea28fb611d4c88077b486fd7c0a8b4c2a25 (diff)
downloadgdb-f53be9779bb1220f33a8a45615e0fafd7b6f47c4.zip
gdb-f53be9779bb1220f33a8a45615e0fafd7b6f47c4.tar.gz
gdb-f53be9779bb1220f33a8a45615e0fafd7b6f47c4.tar.bz2
Check the external compression header size
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.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index adbee93..a99c521 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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);