mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Remove ParserState::lookahead_lexer
The lookahead lexer used by next_token() no longer needs to be kept alive, since tokens created by Parser::next_token() now have any string views guaranteed safe by the fact that they point into the one true SourceCode provided by whoever set up the lexer.
This commit is contained in:
parent
0dacc94edd
commit
fa44fd58d8
Notes:
github-actions[bot]
2025-11-09 11:15:16 +00:00
Author: https://github.com/awesomekling
Commit: fa44fd58d8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6764
2 changed files with 2 additions and 5 deletions
|
|
@ -4291,10 +4291,8 @@ bool Parser::match_declaration(AllowUsingDeclaration allow_using) const
|
|||
|
||||
Token Parser::next_token() const
|
||||
{
|
||||
// We need to keep the lookahead lexer alive to prevent UAF on the lookahead token, as the token may hold a view
|
||||
// into a short string stored on the stack.
|
||||
m_state.lookahead_lexer = m_state.lexer;
|
||||
return m_state.lookahead_lexer->next();
|
||||
auto lookahead_lexer = m_state.lexer;
|
||||
return lookahead_lexer.next();
|
||||
}
|
||||
|
||||
bool Parser::try_match_let_declaration() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue