Add repeat() memory boundary

This commit is contained in:
Anton Medvedev
2023-08-18 14:22:21 +02:00
parent ff899ca004
commit e7cf27415d
+16
View File
@@ -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")
})
}
}