1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

LibJS: Fix crash in Lexer on EOF in unterminated template literal

Fixes #4252.
This commit is contained in:
Linus Groh 2020-11-29 22:59:06 +00:00 committed by Andreas Kling
parent 8284f87867
commit ea08bf5812

View file

@ -451,8 +451,10 @@ Token Lexer::next()
consume();
consume();
}
token_type = TokenType::TemplateLiteralString;
if (is_eof() && !m_template_states.is_empty())
token_type = TokenType::UnterminatedTemplateLiteral;
else
token_type = TokenType::TemplateLiteralString;
}
} else if (is_identifier_start()) {
// identifier or keyword