aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2021-10-21 10:47:06 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-11-09 09:44:47 +0000
commitc9148106881e8e25efc14ec7d49a71f5af4f13f1 (patch)
treeadc387d2b017c7d377df85974eb5e79cb02b726d /gcc
parentea8726cac5af33305fa81886beb4ab2255f99567 (diff)
downloadgcc-c9148106881e8e25efc14ec7d49a71f5af4f13f1.zip
gcc-c9148106881e8e25efc14ec7d49a71f5af4f13f1.tar.gz
gcc-c9148106881e8e25efc14ec7d49a71f5af4f13f1.tar.bz2
[Ada] Add missing regular expression syntax error check
gcc/ada/ * libgnat/s-regexp.adb (Compile.Check_Well_Formed_Patern): When a "|" operator is encountered in a pattern, check that it is not the last character of the pattern.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/s-regexp.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/s-regexp.adb b/gcc/ada/libgnat/s-regexp.adb
index 51ff39c..79e7cda 100644
--- a/gcc/ada/libgnat/s-regexp.adb
+++ b/gcc/ada/libgnat/s-regexp.adb
@@ -210,7 +210,7 @@ package body System.Regexp is
-- or the last occurrence of an opening curly brace, if Glob=True.
procedure Raise_Exception_If_No_More_Chars (K : Integer := 0);
- -- If no more characters are raised, call Raise_Exception
+ -- If S(J + 1 .. S'Last)'Length < K then call Raise_Exception
--------------------------------------
-- Raise_Exception_If_No_More_Chars --
@@ -431,6 +431,9 @@ package body System.Regexp is
& "applied to a term in regular expression", J);
end if;
+ -- A second term must follow
+ Raise_Exception_If_No_More_Chars (K => 1);
+
Past_Elmt := False;
Past_Term := False;
end if;