public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] Don't create _Complex type name if there is no target type name
Date: Tue,  6 Oct 2020 17:49:27 +0200	[thread overview]
Message-ID: <20201006154928.3298-1-ssbssa@yahoo.de> (raw)
In-Reply-To: <20201006154928.3298-1-ssbssa.ref@yahoo.de>

This causes gdb to crash in strlen.

Happens if init_complex_type is called for a type created by
dbx_init_float_type in stabsread.c.

gdb/ChangeLog:

2020-10-06  Hannes Domani  <ssbssa@yahoo.de>

	* gdbtypes.c (init_complex_type): Check target type name.
---
 gdb/gdbtypes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b7c8ec8e64..a40ae5f30e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3283,7 +3283,7 @@ init_complex_type (const char *name, struct type *target_type)
 
   if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr)
     {
-      if (name == nullptr)
+      if (name == nullptr && target_type->name () != nullptr)
 	{
 	  char *new_name
 	    = (char *) TYPE_ALLOC (target_type,
-- 
2.27.0


       reply	other threads:[~2020-10-06 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201006154928.3298-1-ssbssa.ref@yahoo.de>
2020-10-06 15:49 ` Hannes Domani [this message]
2020-10-06 15:49   ` [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader Hannes Domani
2020-10-22 17:21     ` Tom Tromey
2020-10-22 17:21   ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Tom Tromey
2020-10-22 17:40     ` Hannes Domani
2020-10-22 17:46       ` Tom Tromey
2020-10-22 18:20         ` Hannes Domani

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=20201006154928.3298-1-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@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).