public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106607] New: Regex integer overflow on large backreference value
@ 2022-08-13  9:26 fsb4000 at yandex dot ru
  2022-09-07 14:16 ` [Bug libstdc++/106607] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fsb4000 at yandex dot ru @ 2022-08-13  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106607
           Summary: Regex integer overflow on large backreference value
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fsb4000 at yandex dot ru
  Target Milestone: ---

Hello!
I was fixing some MS STL issues with regex: GH-2168: integer overflow on large
backreference value and I added a test.
After that I decided to try my test with LLVM libc++ and GNU libstdc++.
LLVM libc++ passes my test.
and libstdc++ doesn't pass it.

```
#include <cassert>
#include <regex>

using namespace std;

// GH-2168 <regex>: integer overflow on large backreference value
int main() {
    try {
        // 4294967297 = 1 mod 2^32, so this will succeed if we don't check for
overflow.
        regex testRegex{R"((a)\4294967297)", regex_constants::ECMAScript};
        assert(false);
    } catch (const regex_error& e) {
        assert(e.code() == regex_constants::error_backref);
    }
}
```

https://gcc.godbolt.org/z/nzET6nvxo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-23 16:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13  9:26 [Bug libstdc++/106607] New: Regex integer overflow on large backreference value fsb4000 at yandex dot ru
2022-09-07 14:16 ` [Bug libstdc++/106607] " cvs-commit at gcc dot gnu.org
2022-09-07 17:49 ` cvs-commit at gcc dot gnu.org
2022-09-07 17:54 ` redi at gcc dot gnu.org
2023-06-23 16:12 ` cvs-commit at gcc dot gnu.org
2023-06-23 16:19 ` redi at gcc dot gnu.org

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