[gcc r11-7758] Fortran: Fix 'name' bound size [PR99688]
Tobias Burnus
burnus@gcc.gnu.org
Mon Mar 22 08:51:02 GMT 2021
https://gcc.gnu.org/g:0e792ee11aa6ebb6f61e9ed33eb06e260f0ec703
commit r11-7758-g0e792ee11aa6ebb6f61e9ed33eb06e260f0ec703
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Mon Mar 22 09:49:48 2021 +0100
Fortran: Fix 'name' bound size [PR99688]
gcc/fortran/ChangeLog:
PR fortran/99688
* match.c (select_type_set_tmp, gfc_match_select_type,
gfc_match_select_rank): Fix 'name' buffersize to avoid out of bounds.
* resolve.c (resolve_select_type): Likewise.
Diff:
---
gcc/fortran/match.c | 6 +++---
gcc/fortran/resolve.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 4d5890fd523..393755e4d93 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6330,7 +6330,7 @@ select_intrinsic_set_tmp (gfc_typespec *ts)
static void
select_type_set_tmp (gfc_typespec *ts)
{
- char name[GFC_MAX_SYMBOL_LEN];
+ char name[GFC_MAX_SYMBOL_LEN + 12 + 1];
gfc_symtree *tmp = NULL;
gfc_symbol *selector = select_type_stack->selector;
gfc_symbol *sym;
@@ -6409,7 +6409,7 @@ gfc_match_select_type (void)
{
gfc_expr *expr1, *expr2 = NULL;
match m;
- char name[GFC_MAX_SYMBOL_LEN];
+ char name[GFC_MAX_SYMBOL_LEN + 1];
bool class_array;
gfc_symbol *sym;
gfc_namespace *ns = gfc_current_ns;
@@ -6634,7 +6634,7 @@ gfc_match_select_rank (void)
{
gfc_expr *expr1, *expr2 = NULL;
match m;
- char name[GFC_MAX_SYMBOL_LEN];
+ char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_symbol *sym, *sym2;
gfc_namespace *ns = gfc_current_ns;
gfc_array_spec *as = NULL;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 32015c21efc..715fecd4b3a 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9246,7 +9246,7 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
gfc_code *class_is = NULL, *default_case = NULL;
gfc_case *c;
gfc_symtree *st;
- char name[GFC_MAX_SYMBOL_LEN];
+ char name[GFC_MAX_SYMBOL_LEN + 12 + 1];
gfc_namespace *ns;
int error = 0;
int rank = 0;
More information about the Gcc-cvs
mailing list