diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-13 02:26:52 +0430 |
---|---|---|
committer | Gunnar Beutner <gunnar@beutner.name> | 2021-07-13 07:04:06 +0200 |
commit | 9cdea2d5212b1ea343b40fc59bf80ca6668d0f0b (patch) | |
tree | e4f09eb3de5aee1826a1e5ccb2f9b6e1161d0031 /Userland/Libraries/LibRegex/RegexParser.cpp | |
parent | 1b2728f1eda210d0aff1609915725522455dfdd6 (diff) | |
download | serenity-9cdea2d5212b1ea343b40fc59bf80ca6668d0f0b.zip |
LibRegex: Consider EOF in the middle of a range an error
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexParser.cpp')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexParser.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index da2225348a..5d8537d168 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -193,6 +193,9 @@ ALWAYS_INLINE bool AbstractPosixParser::parse_bracket_expression(Vector<CompareT } else if (values.last().type == CharacterCompareType::Char) { values.append({ CharacterCompareType::RangeExpressionDummy, 0 }); + if (done()) + return set_error(Error::MismatchingBracket); + if (match(TokenType::HyphenMinus)) { consume(); // Valid range, add ordinary character |