From patchwork Fri Jan 25 22:36:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: libbacktrace patch committed: Don't crash if no DW_AT_comp_dir Date: Fri, 25 Jan 2013 12:36:13 -0000 From: Ian Taylor X-Patchwork-Id: 215872 Message-Id: To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com 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 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 {