Skip to content

Commit d90488d

Browse files
committed
Add repeat() memory boundary
1 parent 7a494d2 commit d90488d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

builtin/builtin_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,19 @@ func TestBuiltin_types(t *testing.T) {
169169
})
170170
}
171171
}
172+
173+
func TestBuiltin_memory_limits(t *testing.T) {
174+
tests := []struct {
175+
input string
176+
}{
177+
{`repeat("\xc4<\xc4\xc4\xc4",10009999990)`},
178+
}
179+
180+
for _, test := range tests {
181+
t.Run(test.input, func(t *testing.T) {
182+
_, err := expr.Eval(test.input, nil)
183+
assert.Error(t, err)
184+
assert.Contains(t, err.Error(), "memory budget exceeded")
185+
})
186+
}
187+
}

0 commit comments

Comments
 (0)