diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 204bb40..030eb9f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-02-17 Kevin Buettner <kevinb@redhat.com> + + * ada-lang.c (ada_fold_name): Check for non-empty string prior + to accessing it. + (ada_lookup_name_info): Likewise. + 2021-02-13 Mike Frysinger <vapier@gentoo.org> * aclocal.m4: Regenerate. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 416a45b..419347f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -980,7 +980,7 @@ ada_fold_name (gdb::string_view name) int len = name.size (); GROW_VECT (fold_buffer, fold_buffer_size, len + 1); - if (name[0] == '\'') + if (!name.empty () && name[0] == '\'') { strncpy (fold_buffer, name.data () + 1, len - 2); fold_buffer[len - 2] = '\000'; @@ -13650,7 +13650,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name) { gdb::string_view user_name = lookup_name.name (); - if (user_name[0] == '<') + if (!user_name.empty () && user_name[0] == '<') { if (user_name.back () == '>') m_encoded_name |