From: Tom Tromey Date: Wed, 22 Nov 2023 23:36:02 +0000 (-0700) Subject: Fix off-by-one error in compute_delayed_physnames X-Git-Tag: binutils-2_42~710 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3381781151c60cc70a9fb44856e2dd5611465a73;p=thirdparty%2Fbinutils-gdb.git 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 --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;