diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-14 19:44:38 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-14 22:02:25 +0200 |
commit | 8e3fe80c062a4b9ca3e73401b54c7dc885896214 (patch) | |
tree | 281effb7c798407d288a236abcb3a9fe0c37250e /Userland | |
parent | 047c013be0a6adc77799e01ad416eeded5559776 (diff) | |
download | serenity-8e3fe80c062a4b9ca3e73401b54c7dc885896214.zip |
LibRegex: Avoid using GenericLexer::consume() when at eof
Fixes #10027.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexParser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 8fa9dd9b18..55f04c1ca1 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -2229,6 +2229,7 @@ size_t ECMA262Parser::ensure_total_number_of_capturing_parenthesis() } break; case '(': + lexer.consume(); if (lexer.consume_specific('?')) { // non-capturing group '(?:', lookaround '(?<='/'(?<!', or named capture '(?<' if (!lexer.consume_specific('<')) @@ -2242,8 +2243,10 @@ size_t ECMA262Parser::ensure_total_number_of_capturing_parenthesis() ++count; } break; + default: + lexer.consume(); + break; } - lexer.consume(); } m_total_number_of_capturing_parenthesis = count; |