public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Check for null result from gdb_demangle
@ 2020-02-21 15:20 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2020-02-21 15:20 UTC (permalink / raw)
  To: gdb-cvs

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

commit 4f180d5396741eb65badba70cf5077b7d48f8641
Author: Ali Tamur via gdb-patches <gdb-patches@sourceware.org>
Date:   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:
---
 gdb/ChangeLog     | 4 ++++
 gdb/dwarf2/read.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 748788a..d480ff4 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 f998fe6..46d510e 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-21 15:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 15:20 [binutils-gdb] Check for null result from gdb_demangle Tom Tromey

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).