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.
This commit is contained in:
Alan Modra
2023-05-10 23:05:00 +09:30
parent 8b7b3b2bf4
commit 6109320673

View File

@@ -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);