Skip to content

Commit

Permalink
JS: limit recursion in string merges, from OSSFuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Feb 6, 2021
1 parent 29261c3 commit 5715b04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ func (m *jsMinifier) minifyBinaryExpr(expr *js.BinaryExpr) bool {
strings := []*js.LiteralExpr{lit}

left := expr
for {
for len(strings) < 20 { // limit recursion
if lit, ok := left.X.(*js.LiteralExpr); ok && lit.TokenType == js.StringToken {
n += len(lit.Data) - 2
strings = append(strings, lit)
Expand Down

0 comments on commit 5715b04

Please sign in to comment.