From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Re: stack overflow in debug_write_type
Date: Wed, 10 May 2023 13:41:37 +0000 (GMT) [thread overview]
Message-ID: <20230510134137.AB5C63882056@sourceware.org> (raw)
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);
reply other threads:[~2023-05-10 13:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230510134137.AB5C63882056@sourceware.org \
--to=amodra@sourceware.org \
--cc=bfd-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).