summaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-05-10 23:05:00 +0930
committerAlan Modra <amodra@gmail.com>2023-05-10 23:10:19 +0930
commit6109320673fe30163b5d00d9e3a7f4e77befb22a (patch)
treeae64565ea65b87d40f00cb9cdf881ef03e13a117 /binutils
parent8b7b3b2bf4357781439e5434c4a5942ea29e983d (diff)
downloadbinutils-gdb-6109320673fe30163b5d00d9e3a7f4e77befb22a.tar.gz
Re: stack overflow in debug_write_type
Apparently u.kindirect->slot can point at a NULL. * debug.c (debug_write_type): Don't segfault on NULL indirect.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/debug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binutils/debug.c b/binutils/debug.c
index 5cc77f74906..bb26d9143d0 100644
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -2490,7 +2490,8 @@ debug_write_type (struct debug_handle *info,
return false;
case DEBUG_KIND_INDIRECT:
/* Prevent infinite recursion. */
- if ((*type->u.kindirect->slot)->mark == info->mark)
+ if (*type->u.kindirect->slot != DEBUG_TYPE_NULL
+ && (*type->u.kindirect->slot)->mark == info->mark)
return (*fns->empty_type) (fhandle);
return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
name);