-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Describe the bug
OSS-FUZZ is unhappy with a filter that uses _nwise(0).
Note that _nwise(0)
typically behaves like recurse([])
, and one could argue that the def of _nwise/1
is just fine. If the current behavior is judged to be acceptable, what should be done about 68056?
To Reproduce
[1] | _nwise(0)
Expected behavior
If the current behavior is deemed unsatisfactory, how should the def be altered?
Plausible alternatives would include:
def _nwise($n):
def n: if length <= $n then . else .[0:$n] , (.[$n:] | n) end;
if $n <= 0 then empty
else n
end;
and similar alternatives, e.g. replacing empty
above with a call to error
.
(Since the guard is outside def n
, the performance impact would be negligible.)
Additional context
Neither gojq nor jaq define _nwise/1
.
Metadata
Metadata
Assignees
Labels
No labels