public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5020] [Ada] Add missing regular expression syntax error check
@ 2021-11-09  9:45 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-11-09  9:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c9148106881e8e25efc14ec7d49a71f5af4f13f1

commit r12-5020-gc9148106881e8e25efc14ec7d49a71f5af4f13f1
Author: Steve Baird <baird@adacore.com>
Date:   Thu Oct 21 10:47:06 2021 -0700

    [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.

Diff:
---
 gcc/ada/libgnat/s-regexp.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/s-regexp.adb b/gcc/ada/libgnat/s-regexp.adb
index 51ff39c3e76..79e7cda442b 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-09  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09  9:45 [gcc r12-5020] [Ada] Add missing regular expression syntax error check Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).