Skip to content

fix(vm): handle non-comparable groupBy keys#940

Merged
antonmedv merged 1 commit intoexpr-lang:masterfrom
thevilledev:fix/clusterfuzz-488137511
Feb 28, 2026
Merged

fix(vm): handle non-comparable groupBy keys#940
antonmedv merged 1 commit intoexpr-lang:masterfrom
thevilledev:fix/clusterfuzz-488137511

Conversation

@thevilledev
Copy link
Contributor

@thevilledev thevilledev commented Feb 27, 2026

Originally reported in #939 through OSS-Fuzz with this input:

fn( 6/ 2|fn( 0..3) | map( 2|fn($env) ) |groupBy(0..3) )

The groupBy(0..3) evaluates to []int{0, 1, 2, 3} for every element. The groupBy results are stored in map[any][]any where the predicate result is used as the map key. And []int is not comparable, thus the panic:

hash of unhashable type: []int

Check that the groupBy predicate result is comparable before using it as a map key. Now it produces a clear error message instead of a non-descriptive panic:

cannot use []int as a key for groupBy: type is not comparable"

Updated the allow list in the fuzz test harness.

Check that the groupBy predicate result is comparable before
using it as a map key. Previously, a non-comparable type such
as a slice would cause a raw Go runtime panic. Now it produces
a clear error message instead.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
@thevilledev thevilledev marked this pull request as ready for review February 27, 2026 22:29
@antonmedv antonmedv merged commit 851b241 into expr-lang:master Feb 28, 2026
20 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