public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed, PATCH] Check the external compression header size
@ 2016-08-29 15:53 H.J. Lu
  2016-08-30 13:18 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2016-08-29 15:53 UTC (permalink / raw)
  To: binutils

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 | 11 ++++++++---
 binutils/readelf.c |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e709a2d..5ab28f8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
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);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed, PATCH] Check the external compression header size
  2016-08-29 15:53 [committed, PATCH] Check the external compression header size H.J. Lu
@ 2016-08-30 13:18 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2016-08-30 13:18 UTC (permalink / raw)
  To: H.J. Lu, binutils

Hi H.J.

> 	* readelf.c (load_specific_debug_section): Check the external
> 	compression header size.
 
Approved - please apply.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-30 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 15:53 [committed, PATCH] Check the external compression header size H.J. Lu
2016-08-30 13:18 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).