[Bug libbacktrace/81983] sanitizer detects undefined runtime error in libbacktrace

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Feb 10 12:38:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81983

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com,
                   |                            |ian at gcc dot gnu.org,
                   |                            |vries at gcc dot gnu.org
          Component|libfortran                  |libbacktrace

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
AFAIU, this libbacktrace assert corresponds to the runtime error mentioned in
comment 0:
...
diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
index d7dacf3ef32..b99771a2989 100644
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.  */
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <assert.h>

 #include "dwarf2.h"
 #include "filenames.h"
@@ -2821,6 +2822,7 @@ dwarf_lookup_pc (struct backtrace_state *state, struct
dwarf_data *ddata,
   *found = 1;

   /* Find an address range that includes PC.  */
+  assert (ddata->addrs != NULL);
   entry = bsearch (&pc, ddata->addrs, ddata->addrs_count,
                   sizeof (struct unit_addrs), unit_addrs_search);

...

I can trigger the assert with btest_dwz, for the btest_common.debug file, which
doesn't contain any addresses.


More information about the Gcc-bugs mailing list