Skip to content

Conversation

@thevilledev
Copy link
Contributor

@thevilledev thevilledev commented Jan 24, 2026

Fixes OSS-Fuzz timeout #893 caused by expressions like "-817810..178" creating ~818K element arrays that exceeded the 60s timeout when passed to fmt.Sprintf for string formatting.

I had this as an alternative, basically to modify the fuzz test helper to skip formatting large input:

func Func() expr.Option {
    return expr.Function("fn", func(params ...any) (any, error) {
        // Avoid expensive string formatting of large slices
        if len(params) == 1 {
            if arr, ok := params[0].([]int); ok && len(arr) > 10000 {
                return fmt.Sprintf("fn([%d elements])", len(arr)), nil
            }
        }
        return fmt.Sprintf("fn(%v)", params), nil
    })
}

But the mem budget modification felt like a cleaner option.

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>
@antonmedv antonmedv merged commit 553025a into expr-lang:master Jan 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants