* [PATCH] libdw: Don't assert in __libdw_getabbrev when seeing bad DWARF.
@ 2014-11-23 23:20 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-11-23 23:20 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libdw/ChangeLog | 5 +++++
libdw/dwarf_getabbrev.c | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 58736a6..a81c339 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getabbrev.c (__libdw_getabbrev): Don't assert on bad DWARF.
+ Set libdw errno and return NULL.
+
2014-11-11 Mark Wielaard <mjw@redhat.com>
* dwarf_getsrclines.c (read_srclines): Do address_size comparison
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index 87d89c1..95233cf 100644
--- a/libdw/dwarf_getabbrev.c
+++ b/libdw/dwarf_getabbrev.c
@@ -1,5 +1,5 @@
/* Get abbreviation at given offset.
- Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -31,7 +31,6 @@
# include <config.h>
#endif
-#include <assert.h>
#include <dwarf.h>
#include "libdwP.h"
@@ -97,7 +96,13 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
{
foundit = true;
- assert (abb->offset == offset);
+ if (abb->offset != offset)
+ {
+ /* A duplicate abbrev code at a different offset,
+ that should never happen. */
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
/* If the caller doesn't need the length we are done. */
if (lengthp == NULL)
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-23 23:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-23 23:20 [PATCH] libdw: Don't assert in __libdw_getabbrev when seeing bad DWARF 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).