public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5020] [Ada] Add missing regular expression syntax error check
Date: Tue,  9 Nov 2021 09:45:49 +0000 (GMT)	[thread overview]
Message-ID: <20211109094549.E225D3858423@sourceware.org> (raw)

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;


                 reply	other threads:[~2021-11-09  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211109094549.E225D3858423@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).