aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-08-26 19:06:28 +0930
committerAlan Modra <amodra@gmail.com>2019-08-26 19:31:10 +0930
commit37606e67df760b14ecf8dd9cf870a2364541b0b6 (patch)
tree2b81512adc97c5b5eb96d6ca14e9541dba4f0b81
parentdb3b6ecc28a079768dc4661e459c4a68039e8483 (diff)
downloadgdb-37606e67df760b14ecf8dd9cf870a2364541b0b6.zip
gdb-37606e67df760b14ecf8dd9cf870a2364541b0b6.tar.gz
gdb-37606e67df760b14ecf8dd9cf870a2364541b0b6.tar.bz2
PR24938, Null Pointer Dereference in debug.c:debug_write_type
PR 24938 * debug.c (debug_write_type): Call empty_type for NULL type here.. (debug_write_type): ..rather than in just one case here.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/debug.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e5b197a..1516076 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-26 Alan Modra <amodra@gmail.com>
+
+ PR 24938
+ * debug.c (debug_write_type): Call empty_type for NULL type here..
+ (debug_write_type): ..rather than in just one case here.
+
2019-08-23 Nick Clifton <nickc@redhat.com>
PR 24829
diff --git a/binutils/debug.c b/binutils/debug.c
index 5c984b7..925d84c 100644
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -2419,6 +2419,9 @@ debug_write_type (struct debug_handle *info,
int is;
const char *tag = NULL;
+ if (type == DEBUG_TYPE_NULL)
+ return (*fns->empty_type) (fhandle);
+
/* If we have a name for this type, just output it. We only output
typedef names after they have been defined. We output type tags
whenever we are not actually defining them. */
@@ -2481,8 +2484,6 @@ debug_write_type (struct debug_handle *info,
debug_error (_("debug_write_type: illegal type encountered"));
return FALSE;
case DEBUG_KIND_INDIRECT:
- if (*type->u.kindirect->slot == DEBUG_TYPE_NULL)
- return (*fns->empty_type) (fhandle);
return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
name);
case DEBUG_KIND_VOID: