From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: [PATCH] libdw: Don't assert in __libdw_getabbrev when seeing bad DWARF.
Date: Mon, 24 Nov 2014 00:20:58 +0100 [thread overview]
Message-ID: <1416784858-307-1-git-send-email-mjw@redhat.com> (raw)
[-- 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
reply other threads:[~2014-11-23 23:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416784858-307-1-git-send-email-mjw@redhat.com \
--to=mjw@redhat.com \
--cc=elfutils-devel@lists.fedorahosted.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).