public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Check for null result from gdb_demangle
Date: Thu, 05 Mar 2020 01:24:00 -0000	[thread overview]
Message-ID: <4f180d5396741eb65badba70cf5077b7d48f8641@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 4f180d5396741eb65badba70cf5077b7d48f8641 ***

commit 4f180d5396741eb65badba70cf5077b7d48f8641
Author:     Ali Tamur via gdb-patches <gdb-patches@sourceware.org>
AuthorDate: Fri Feb 21 08:19:21 2020 -0700
Commit:     Tom Tromey <tromey@adacore.com>
CommitDate: Fri Feb 21 08:19:21 2020 -0700

    Check for null result from gdb_demangle
    
    I am sending this patch on behalf of kmoy@google.com, who discovered the bug
    and wrote the fix.
    
    gdb_demangle can return null for strings that don't properly demangle. The null
    check was mistakenly removed in commit 43816ebc335. Without this check, GDB
    aborts when loading symbols from some binaries.
    
    gdb/ChangeLog
    2020-02-21  Ali Tamur  <tamur@google.com>
    
            * dwarf2/read.c (dwarf2_name): Add null check.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 748788acac..d480ff4e15 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-02-21  Ali Tamur  <tamur@google.com>
+
+	* dwarf2/read.c (dwarf2_name): Add null check.
+
 2020-02-20  Tom Tromey  <tom@tromey.com>
 
 	* dwarf2/read.c (dwarf2_find_containing_comp_unit): Use ">", not
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f998fe6b8d..46d510eb27 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21756,6 +21756,8 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
 	    {
 	      gdb::unique_xmalloc_ptr<char> demangled
 		(gdb_demangle (DW_STRING (attr), DMGL_TYPES));
+	      if (demangled == nullptr)
+		return nullptr;
 
 	      const char *base;
 


             reply	other threads:[~2020-03-05  0:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  1:24 gdb-buildbot [this message]
2020-03-05  1:00 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2020-03-05  3:09 ` Failures on Fedora-i686, " gdb-buildbot
2020-03-05  3:10 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-03-05  4:15 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-03-05  4:30 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-03-05  4:46 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-06  0:43 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-03-07 12:31 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

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=4f180d5396741eb65badba70cf5077b7d48f8641@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).