public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] libdwfl: Arange CU cannot point to the EOF marker.
@ 2015-05-12 14:32 Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2015-05-12 14:32 UTC (permalink / raw)
  To: elfutils-devel

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

On Thu, 2015-05-07 at 11:21 -0700, Roland McGrath wrote:
> Use unlikely.  Otherwise looks good.

Thanks. I merged this particular check into intern_cu in "libdwfl: Only
intern CU when not EOF marker and cuoff points to a DIE.", but will make
sure there are unlikely annotations when I check this in.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [PATCH] libdwfl: Arange CU cannot point to the EOF marker.
@ 2015-05-07 18:21 Roland McGrath
  0 siblings, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2015-05-07 18:21 UTC (permalink / raw)
  To: elfutils-devel

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

Use unlikely.  Otherwise looks good.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] libdwfl: Arange CU cannot point to the EOF marker.
@ 2015-05-07 13:46 Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2015-05-07 13:46 UTC (permalink / raw)
  To: elfutils-devel

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

Don't assert, just report DWARF_E_INVALID_DWARF.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libdwfl/ChangeLog | 4 ++++
 libdwfl/cu.c      | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 675c4e2..97ec954 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-07  Mark Wielaard  <mjw@redhat.com>
+
+	* cu.c (arangecu): Return DWARF_E_INVALID_DWARF if arange cu is -1.
+
 2015-05-05  Mark Wielaard  <mjw@redhat.com>
 
 	* cu.c (intern_cu): Check cuoff points to a real Dwarf_Die before
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index dbbed85..ddd4913 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -294,7 +294,13 @@ arangecu (Dwfl_Module *mod, struct dwfl_arange *arange, struct dwfl_cu **cu)
       Dwfl_Error result = intern_cu (mod, dwarange->offset, &arange->cu);
       if (result != DWFL_E_NOERROR)
 	return result;
-      assert (arange->cu != NULL && arange->cu != (void *) -1l);
+      assert (arange->cu != NULL);
+      if (arange->cu == (void *) -1l)
+	{
+	  // An arange cannot point to the EOF marker.
+	  arange->cu = NULL;
+	  return (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF));
+	}
       less_lazy (mod);		/* Each arange with null ->cu counts once.  */
     }
 
-- 
2.1.0


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

end of thread, other threads:[~2015-05-12 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 14:32 [PATCH] libdwfl: Arange CU cannot point to the EOF marker Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2015-05-07 18:21 Roland McGrath
2015-05-07 13:46 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).