public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] readelf: Don't print more augmentation characters than there are.
@ 2014-12-15  9:06 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-15  9:06 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

On Thu, 2014-12-11 at 17:22 +0100, Mark Wielaard wrote:
> +2014-12-11  Mark Wielaard  <mjw@redhat.com>
> +
> +	* readelf.c (print_debug_frame_section): Check number of augmentation
> +	chars to print.

I pushed this to master.

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

* [PATCH] readelf: Don't print more augmentation characters than there are.
@ 2014-12-11 16:22 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-11 16:22 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 src/ChangeLog | 5 +++++
 src/readelf.c | 7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 456e5a4..0ae7e46 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-11  Mark Wielaard  <mjw@redhat.com>
+
+	* readelf.c (print_debug_frame_section): Check number of augmentation
+	chars to print.
+
 2014-12-09  Mark Wielaard  <mjw@redhat.com>
 
 	* readelf.c (handle_file_note): Check count fits data section and
diff --git a/src/readelf.c b/src/readelf.c
index c6d10f7..31a0e0a 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -5490,7 +5490,7 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 	      unsigned int augmentationlen;
 	      get_uleb128 (augmentationlen, readp);
 
-	      if (augmentationlen > (size_t) (dataend - readp))
+	      if (augmentationlen > (size_t) (cieend - readp))
 		{
 		  error (0, 0, gettext ("invalid augmentation length"));
 		  readp = cieend;
@@ -5499,7 +5499,7 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 
 	      const char *hdr = "Augmentation data:";
 	      const char *cp = augmentation + 1;
-	      while (*cp != '\0')
+	      while (*cp != '\0' && cp < augmentation + augmentationlen + 1)
 		{
 		  printf ("   %-26s%#x ", hdr, *readp);
 		  hdr = "";
@@ -5655,7 +5655,8 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 		  const char *hdr = "Augmentation data:";
 		  const char *cp = cie->augmentation + 1;
 		  unsigned int u = 0;
-		  while (*cp != '\0')
+		  while (*cp != '\0'
+			 && cp < cie->augmentation + augmentationlen + 1)
 		    {
 		      if (*cp == 'L')
 			{
-- 
1.8.3.1


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

end of thread, other threads:[~2014-12-15  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15  9:06 [PATCH] readelf: Don't print more augmentation characters than there are Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-12-11 16:22 Mark Wielaard

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).