Skip to content

Commit

Permalink
Add exprLevel maximum for expression suffices as well
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Apr 26, 2021
1 parent 8c2ea15 commit ef4f18b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,12 @@ func (p *Parser) parseExpression(prec OpPrec) IExpr {
}

func (p *Parser) parseExpressionSuffix(left IExpr, prec, precLeft OpPrec) IExpr {
for {
for i := 0; ; i++ {
if 1000 < p.exprLevel+i {
p.failMessage("too many nested expressions")
return nil
}

switch tt := p.tt; tt {
case EqToken, MulEqToken, DivEqToken, ModEqToken, ExpEqToken, AddEqToken, SubEqToken, LtLtEqToken, GtGtEqToken, GtGtGtEqToken, BitAndEqToken, BitXorEqToken, BitOrEqToken, AndEqToken, OrEqToken, NullishEqToken:
if OpAssign < prec {
Expand Down

0 comments on commit ef4f18b

Please sign in to comment.