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

Panic in array.slice built-in due to incorrect clamping #2320

Closed
tsandall opened this issue Apr 21, 2020 · 0 comments · Fixed by #2321
Closed

Panic in array.slice built-in due to incorrect clamping #2320

tsandall opened this issue Apr 21, 2020 · 0 comments · Fixed by #2321
Assignees
Labels

Comments

@tsandall
Copy link
Member

This is easy to reproduce:

docker run --rm openpolicyagent/opa:0.19.1 eval 'array.slice([], 1, 2)'
@tsandall tsandall added the bug label Apr 21, 2020
@tsandall tsandall self-assigned this Apr 21, 2020
tsandall added a commit to tsandall/opa that referenced this issue Apr 21, 2020
The built-in function implemented clamping in an odd way. With this
change, the stopIndex will always be [0, len(arr)] and the startIndex
will always be [0, clamped_stopIndex].

Fixes open-policy-agent#2320

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
tsandall added a commit that referenced this issue Apr 21, 2020
The built-in function implemented clamping in an odd way. With this
change, the stopIndex will always be [0, len(arr)] and the startIndex
will always be [0, clamped_stopIndex].

Fixes #2320

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant