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

topdown: Fix corrupt object panic caused by copy propagation #1519

Merged
merged 1 commit into from
Jun 26, 2019

Conversation

tsandall
Copy link
Member

Mutating term values used as object keys (or set elements) is not safe
because the underlying hashtables get corrupted. This a known issue
that was previously fixed in the compiler (#1125). The simplest
solution in this case is to use the ast.Transform helper instead of
ast.Walk so that a copy of object and set terms is made.

Fixes #1177

Signed-off-by: Torin Sandall torinsandall@gmail.com

Mutating term values used as object keys (or set elements) is not safe
because the underlying hashtables get corrupted. This a known issue
that was previously fixed in the compiler (open-policy-agent#1125). The simplest
solution in this case is to use the ast.Transform helper instead of
ast.Walk so that a copy of object and set terms is made.

Fixes open-policy-agent#1177

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Copy link
Contributor

@patrick-east patrick-east left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense to me, although I'm not very familiar with some of this code so my review is mostly just on the changes and not the bigger picture of any implications this has.. It fixes the related bug and tests pass though, so +1 😄

@tsandall tsandall merged commit 5698383 into open-policy-agent:master Jun 26, 2019
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.

corrupt object panic during partial evaluation when ref used as object key
2 participants