]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix off-by-one error in compute_delayed_physnames
authorTom Tromey <tom@tromey.com>
Wed, 22 Nov 2023 23:36:02 +0000 (16:36 -0700)
committerTom Tromey <tom@tromey.com>
Tue, 5 Dec 2023 14:17:57 +0000 (07:17 -0700)
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

index 9311666a832bd06daff1fefc14264bcfe3f1b7bc..d83487007243e34f3937fb2869fce7f78aa0ce63 100644 (file)
@@ -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;