From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Fix off-by-one error in compute_delayed_physnames
Date: Wed, 22 Nov 2023 22:31:32 -0700 [thread overview]
Message-ID: <20231123053132.608835-1-tom@tromey.com> (raw)
compute_delayed_physnames does this:
size_t len = strlen (physname);
...
if (physname[len] == ')') /* shortcut */
break;
However, physname[len] will always be \0.
This patch changes it to the correct len-1.
---
gdb/dwarf2/read.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 9f3297a2d4e..c4943362fa2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5647,7 +5647,7 @@ compute_delayed_physnames (struct dwarf2_cu *cu)
while (1)
{
- if (physname[len] == ')') /* shortcut */
+ if (physname[len - 1] == ')') /* shortcut */
break;
else if (check_modifier (physname, len, " const"))
TYPE_FN_FIELD_CONST (fn_flp->fn_fields, mi.index) = 1;
--
2.41.0
next reply other threads:[~2023-11-23 5:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 5:31 Tom Tromey [this message]
2023-12-04 18:46 ` Tom Tromey
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=20231123053132.608835-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@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).