* [PATCH] Fix off-by-one error in compute_delayed_physnames
@ 2023-11-23 5:31 Tom Tromey
2023-12-04 18:46 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2023-11-23 5:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix off-by-one error in compute_delayed_physnames
2023-11-23 5:31 [PATCH] Fix off-by-one error in compute_delayed_physnames Tom Tromey
@ 2023-12-04 18:46 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-12-04 18:46 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> compute_delayed_physnames does this:
Tom> size_t len = strlen (physname);
Tom> ...
Tom> if (physname[len] == ')') /* shortcut */
Tom> break;
Tom> However, physname[len] will always be \0.
Tom> This patch changes it to the correct len-1.
This is fairly trivial; I'm going to check it in now.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-04 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 5:31 [PATCH] Fix off-by-one error in compute_delayed_physnames Tom Tromey
2023-12-04 18:46 ` Tom Tromey
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).