public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/30357] Segmentation fault for the 'start' command
Date: Tue, 18 Apr 2023 03:47:25 +0000	[thread overview]
Message-ID: <bug-30357-4717-BtHRUt2cwm@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30357-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30357

--- Comment #10 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-13-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=69eedc8e312685d9c0055098e9c461b95a2e832f

commit 69eedc8e312685d9c0055098e9c461b95a2e832f
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Apr 18 05:47:21 2023 +0200

    [gdb/symtab] Handle empty file name in .debug_line section

    With DWARF 5, it's possible to produce an empty file name in the File Name
    Table of the .debug_line section:
    ...
     The File Name Table (offset 0x112, lines 1, columns 2):
      Entry Dir     Name
      0     1       (indirect line string, offset: 0x2d):
    ...

    Currently, when gdb reads an exec containing such debug info, it segfaults:
    ...
    Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
    0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...)
at \
      gdb/dwarf2/read.c:18716
    18716     if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
    ...
    because read_direct_string transforms "" into a nullptr, and we end up
    dereferencing the nullptr.

    Note that the behaviour of read_direct_string has been present since repo
    creation.

    Fix this in read_formatted_entries, by transforming nullptr filenames in to
""
    filenames.

    Tested on x86_64-linux.

    Reviewed-By: Tom Tromey <tom@tromey.com>

    PR symtab/30357
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30357

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-04-18  3:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15  3:28 [Bug gdb/30357] New: " yangyibiao at nju dot edu.cn
2023-04-15  3:28 ` [Bug gdb/30357] " yangyibiao at nju dot edu.cn
2023-04-15  8:29 ` vries at gcc dot gnu.org
2023-04-16  6:34 ` vries at gcc dot gnu.org
2023-04-16 13:23 ` yangyibiao at nju dot edu.cn
2023-04-16 13:51 ` tromey at sourceware dot org
2023-04-17  8:25 ` [Bug symtab/30357] " vries at gcc dot gnu.org
2023-04-17  8:29 ` vries at gcc dot gnu.org
2023-04-17  8:36 ` vries at gcc dot gnu.org
2023-04-17  9:18 ` vries at gcc dot gnu.org
2023-04-17 16:09 ` cvs-commit at gcc dot gnu.org
2023-04-17 16:12 ` vries at gcc dot gnu.org
2023-04-18  3:47 ` cvs-commit at gcc dot gnu.org [this message]
2023-04-18  3:48 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30357-4717-BtHRUt2cwm@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).