This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] libdwfl: Arange CU cannot point to the EOF marker.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 07 May 2015 15:46:10 +0200
- Subject: [PATCH] libdwfl: Arange CU cannot point to the EOF marker.
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