Signed-off-by: Mark Wielaard <m...@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 <m...@redhat.com> + + * dwarf_getabbrev.c (__libdw_getabbrev): Don't assert on bad DWARF. + Set libdw errno and return NULL. + 2014-11-11 Mark Wielaard <m...@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 <drep...@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