This patch, written by Jakub in PR 56076, avoids crashing in
libbacktrace if it sees a relative file name but did not see a
DW_AT_comp_dir attribute.  Bootstrapped and ran libbacktrace testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2013-01-25  Jakub Jelinek  <ja...@redhat.com>

        PR other/56076
        * dwarf.c (read_line_header): Don't crash if DW_AT_comp_dir
        attribute was not seen.


Index: dwarf.c
===================================================================
--- dwarf.c	(revision 195436)
+++ dwarf.c	(working copy)
@@ -1655,7 +1655,8 @@ read_line_header (struct backtrace_state
 		    strnlen ((const char *) hdr_buf.buf, hdr_buf.left) + 1))
 	return 0;
       dir_index = read_uleb128 (&hdr_buf);
-      if (IS_ABSOLUTE_PATH (filename))
+      if (IS_ABSOLUTE_PATH (filename)
+	  || (dir_index == 0 && u->comp_dir == NULL))
 	hdr->filenames[i] = filename;
       else
 	{

Reply via email to