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

REPL panics when partial evaluation result is empty #909

Closed
tsandall opened this issue Aug 29, 2018 · 0 comments
Closed

REPL panics when partial evaluation result is empty #909

tsandall opened this issue Aug 29, 2018 · 0 comments

Comments

@tsandall
Copy link
Member

The REPL will panic if the result of partial evaluation contains an empty query. This can be reproduced by simply enabling partial evaluation and then evaluating a trivial query like true.

> unknown input
> true

The problem is that the ast.Body location getter assumes that bodies are non-empty.

tsandall added a commit to tsandall/opa that referenced this issue Aug 29, 2018
Previously, if an empty ast.Body was passed to the formatting package,
it would trigger a panic because the location getter would try to index
into an empty slice.

These changes make the location getter tolerate empty bodies and the
format package tolerate nil locations on empty bodies. The changes also
improve simplify the error message when nil locations are found.

Fixes open-policy-agent#909

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
tsandall added a commit that referenced this issue Aug 29, 2018
Previously, if an empty ast.Body was passed to the formatting package,
it would trigger a panic because the location getter would try to index
into an empty slice.

These changes make the location getter tolerate empty bodies and the
format package tolerate nil locations on empty bodies. The changes also
improve simplify the error message when nil locations are found.

Fixes #909

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
None yet
Projects
None yet
Development

No branches or pull requests

1 participant