Patchwork libbacktrace patch committed: Don't crash if no DW_AT_comp_dir

login
register
mail settings
Submitter Ian Taylor
Date Jan. 25, 2013, 10:36 p.m.
Message ID <mcrvcak99gi.fsf@google.com>
Download mbox | patch
Permalink /patch/215872/
State New
Headers show

Comments

Ian Taylor - Jan. 25, 2013, 10:36 p.m.
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  <jakub@redhat.com>

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

Patch

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
 	{