Skip to content

Commit 553025a

Browse files
authored
fix(fuzz): reduce mem budget to prevent timeouts (#913)
Fixes OSS-Fuzz timeout caused by expressions like "-817810..178" creating ~818K element arrays that exceeded the 60s timeout when passed to fmt.Sprintf for string formatting. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
1 parent 77df211 commit 553025a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/fuzz/fuzz_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
"github.com/expr-lang/expr"
10+
"github.com/expr-lang/expr/vm"
1011
)
1112

1213
//go:embed fuzz_corpus.txt
@@ -76,7 +77,8 @@ func FuzzExpr(f *testing.F) {
7677
t.Skipf("compile error: %s", err)
7778
}
7879

79-
_, err = expr.Run(program, env)
80+
v := vm.VM{MemoryBudget: 500000}
81+
_, err = v.Run(program, env)
8082
if err != nil {
8183
for _, r := range skip {
8284
if r.MatchString(err.Error()) {

0 commit comments

Comments
 (0)