public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rs2740 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/102447] std::regex incorrectly accepts invalid bracket expression
Date: Sat, 02 Oct 2021 16:54:56 +0000	[thread overview]
Message-ID: <bug-102447-4-CAAICkXdA6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102447-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102447

--- Comment #7 from TC <rs2740 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #6)
> I have looked in detail (I have the 3rd, 4th and 5th editions here) but my
> brain started oozing out of my ears.
> 
> 15.10.2.15 NonemptyClassRanges and 15.10.2.16 NonemptyClassRangesNoDash are
> the relevant sections of the 1999 3rd edition. The former defines:
> 
>   The internal helper function CharacterRange takes two CharSet parameters
>   A and B and performs the following:
>   1. If A does not contain exactly one character or B does not contain
> exactly
>   one character then throw a SyntaxError exception.
> 
> And the latter has this note:
> 
>   Informative comments: ClassRanges can expand into single ClassAtoms and/or
>   ranges of two ClassAtoms separated by dashes. In the latter case the
>   ClassRanges includes all characters between the first ClassAtom and the
>   second ClassAtom, inclusive; an error occurs if either ClassAtom does not
>   represent a single character (for example, if one is \w) or if the first
>   ClassAtom's code point value is greater than the second ClassAtom's code
>   point value.
> 
> 
> 
> The ClassAtom \w does not contain exactly one character, so I think it's a
> syntax error.
> 
> The 3rd edition doesn't mention any legacy features of RegExp, but it does
> seem to require the strict behaviour.

I've looked at the 1999 spec now, and agree with your reading.

  parent reply	other threads:[~2021-10-02 16:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 10:06 [Bug libstdc++/102447] New: " redi at gcc dot gnu.org
2021-09-24 18:50 ` [Bug libstdc++/102447] " mpolacek at gcc dot gnu.org
2021-09-24 19:03 ` redi at gcc dot gnu.org
2021-09-24 21:32 ` redi at gcc dot gnu.org
2021-09-27 11:45 ` redi at gcc dot gnu.org
2021-10-01 10:24 ` redi at gcc dot gnu.org
2021-10-02  1:28 ` rs2740 at gmail dot com
2021-10-02  6:55 ` redi at gcc dot gnu.org
2021-10-02 16:54 ` rs2740 at gmail dot com [this message]
2021-10-04  5:09 ` s.ikarashi at fujitsu dot com
2021-12-13 22:27 ` redi at gcc dot gnu.org
2021-12-14 21:47 ` cvs-commit at gcc dot gnu.org
2021-12-14 21:51 ` redi at gcc dot gnu.org
2022-07-07 23:33 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:37 ` redi at gcc dot gnu.org
2023-06-23 16:12 ` cvs-commit at gcc dot gnu.org
2023-06-23 16:18 ` redi at gcc dot gnu.org

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=bug-102447-4-CAAICkXdA6@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).