Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oss-fuzz/issues/detail?id=68056 #3148

Open
pkoppstein opened this issue Jul 9, 2024 · 0 comments
Open

oss-fuzz/issues/detail?id=68056 #3148

pkoppstein opened this issue Jul 9, 2024 · 0 comments

Comments

@pkoppstein
Copy link
Contributor

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.

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

No branches or pull requests

1 participant