summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-13 02:16:19 +0430
committerGunnar Beutner <gunnar@beutner.name>2021-07-13 07:04:06 +0200
commit1b2728f1eda210d0aff1609915725522455dfdd6 (patch)
treebf90f18d3dbc0c338ff52ff48392b404bfa158a6 /Userland
parent6e35b9403465f8c9ac69c41810f1304847c5c53e (diff)
downloadserenity-1b2728f1eda210d0aff1609915725522455dfdd6.zip
LibRegex: Don't attempt to insert invalid bytecode in {B,E}RE
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp
index e50db2a5b2..da2225348a 100644
--- a/Userland/Libraries/LibRegex/RegexParser.cpp
+++ b/Userland/Libraries/LibRegex/RegexParser.cpp
@@ -497,7 +497,8 @@ bool PosixBasicParser::parse_one_char_or_collation_element(ByteCode& bytecode, s
consume(TokenType::RightBracket, Error::MismatchingBracket);
- bytecode.insert_bytecode_compare_values(move(values));
+ if (!has_error())
+ bytecode.insert_bytecode_compare_values(move(values));
match_length_minimum += bracket_minimum_length;
return !has_error();
}
@@ -617,7 +618,8 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack
if (!AbstractPosixParser::parse_bracket_expression(values, match_length_minimum))
return false;
- stack.insert_bytecode_compare_values(move(values));
+ if (!has_error())
+ stack.insert_bytecode_compare_values(move(values));
return !has_error();
}