public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Re: stack overflow in debug_write_type
@ 2023-05-10 13:41 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-05-10 13:41 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6109320673fe30163b5d00d9e3a7f4e77befb22a

commit 6109320673fe30163b5d00d9e3a7f4e77befb22a
Author: Alan Modra <amodra@gmail.com>
Date:   Wed May 10 23:05:00 2023 +0930

    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.

Diff:
---
 binutils/debug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-10 13:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 13:41 [binutils-gdb] Re: stack overflow in debug_write_type Alan Modra

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).