]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't create _Complex type name if there is no target type name
authorHannes Domani <ssbssa@yahoo.de>
Tue, 6 Oct 2020 15:08:42 +0000 (17:08 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Thu, 22 Oct 2020 18:05:32 +0000 (20:05 +0200)
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-22  Hannes Domani  <ssbssa@yahoo.de>

* gdbtypes.c (init_complex_type): Check target type name.

gdb/ChangeLog
gdb/gdbtypes.c

index 4358b449856ebb6c2992040ccc24115ef8724564..4baafd41094a5084e540094c833220ad90426c4b 100644 (file)
@@ -1,3 +1,7 @@
+2020-10-22  Hannes Domani  <ssbssa@yahoo.de>
+
+       * gdbtypes.c (init_complex_type): Check target type name.
+
 2020-10-22  Simon Marchi  <simon.marchi@polymtl.ca>
 
        PR gdb/26693
index b7c8ec8e6432bccccbe27f8c24f885e5a349e0a6..a40ae5f30eba8b277bb88c73928726e2be25feab 100644 (file)
@@ -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,