[Parser] Fix OOM in parsing of incorrect string literals
^KT-46455 Fixed KT-34410 KT-46564
This commit is contained in:
committed by
TeamCityServer
parent
c284eab2dd
commit
3532ce7fbc
@@ -105,7 +105,7 @@ import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
||||
IElementType tt = tt();
|
||||
if (recoverySet == null ||
|
||||
recoverySet.contains(tt) ||
|
||||
tt == LBRACE || tt == RBRACE || tt == LONG_TEMPLATE_ENTRY_END ||
|
||||
tt == LBRACE || tt == RBRACE ||
|
||||
(recoverySet.contains(EOL_OR_SEMICOLON) && (eof() || tt == SEMICOLON || myBuilder.newlineBeforeCurrentToken()))) {
|
||||
error(message);
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
else if (!parseLiteralConstant()) {
|
||||
ok = false;
|
||||
// TODO: better recovery if FIRST(element) did not match
|
||||
errorWithRecovery("Expecting an element", EXPRESSION_FOLLOW);
|
||||
errorWithRecovery("Expecting an element", TokenSet.orSet(EXPRESSION_FOLLOW, TokenSet.create(LONG_TEMPLATE_ENTRY_END)));
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
Reference in New Issue
Block a user