summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getabbrev.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-11-23 23:13:55 +0100
committerMark Wielaard <[email protected]>2014-11-26 20:25:49 +0100
commit04b61f8601bf9267976cc4461091622ffdbadf67 (patch)
tree71644bf3ec28e2e5379b306cabf80363fb25ffae /libdw/dwarf_getabbrev.c
parentf62658f71fdcf6a51e0dac1bfe4ab082be03bb8a (diff)
libdw: Don't assert in __libdw_getabbrev when seeing bad DWARF.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_getabbrev.c')
-rw-r--r--libdw/dwarf_getabbrev.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index 87d89c1b..6bb2bd76 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 <[email protected]>, 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 (unlikely (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)