public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] readelf: Check TType base offset and Action table are sane in exception table.
@ 2014-12-15  9:08 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-15  9:08 UTC (permalink / raw)
  To: elfutils-devel

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

On Thu, 2014-12-11 at 18:26 +0100, Mark Wielaard wrote:
>  2014-12-11  Mark Wielaard  <mjw@redhat.com>
>  
> +	* readelf.c (print_debug_exception_table): Check TType base offset
> +	and Action table are sane.

I pushed this to master.

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

* [PATCH] readelf: Check TType base offset and Action table are sane in exception table.
@ 2014-12-11 17:26 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-11 17:26 UTC (permalink / raw)
  To: elfutils-devel

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

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

diff --git a/src/ChangeLog b/src/ChangeLog
index 0ae7e46..cc6bf13 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-11  Mark Wielaard  <mjw@redhat.com>
 
+	* readelf.c (print_debug_exception_table): Check TType base offset
+	and Action table are sane.
+
+2014-12-11  Mark Wielaard  <mjw@redhat.com>
+
 	* readelf.c (print_debug_frame_section): Check number of augmentation
 	chars to print.
 
diff --git a/src/readelf.c b/src/readelf.c
index 31a0e0a..fb0440d 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -7710,7 +7710,8 @@ print_debug_exception_table (Dwfl_Module *dwflmod __attribute__ ((unused)),
       unsigned int ttype_base_offset;
       get_uleb128 (ttype_base_offset, readp);
       printf (" TType base offset:   %#x\n", ttype_base_offset);
-      ttype_base = readp + ttype_base_offset;
+      if (dataend - readp > ttype_base_offset)
+        ttype_base = readp + ttype_base_offset;
     }
 
   if (unlikely (readp + 1 > dataend))
@@ -7757,6 +7758,12 @@ print_debug_exception_table (Dwfl_Module *dwflmod __attribute__ ((unused)),
     {
       puts ("\n Action table:");
 
+      if (dataend - action_table < max_action + 1)
+	{
+	  fputs (gettext ("   <INVALID DATA>\n"), stdout);
+	  return;
+	}
+
       const unsigned char *const action_table_end
 	= action_table + max_action + 1;
 
@@ -7784,7 +7791,7 @@ print_debug_exception_table (Dwfl_Module *dwflmod __attribute__ ((unused)),
       while (readp < action_table_end);
     }
 
-  if (max_ar_filter > 0)
+  if (max_ar_filter > 0 && ttype_base != NULL)
     {
       puts ("\n TType table:");
 
-- 
1.8.3.1


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

end of thread, other threads:[~2014-12-15  9:08 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:08 [PATCH] readelf: Check TType base offset and Action table are sane in exception table Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-12-11 17:26 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).