mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
Add repeat() memory boundary
This commit is contained in:
@@ -169,3 +169,19 @@ func TestBuiltin_types(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuiltin_memory_limits(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
}{
|
||||
{`repeat("\xc4<\xc4\xc4\xc4",10009999990)`},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.input, func(t *testing.T) {
|
||||
_, err := expr.Eval(test.input, nil)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "memory budget exceeded")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user