public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix off-by-one error in compute_delayed_physnames
@ 2023-12-05 14:18 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-12-05 14:18 UTC (permalink / raw)
  To: gdb-cvs

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

commit 3381781151c60cc70a9fb44856e2dd5611465a73
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Nov 22 16:36:02 2023 -0700

    Fix off-by-one error in compute_delayed_physnames
    
    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.

Diff:
---
 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 9311666a832..d8348700724 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;

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

only message in thread, other threads:[~2023-12-05 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 14:18 [binutils-gdb] Fix off-by-one error in compute_delayed_physnames 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).