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: local variable rewriting corrupts objects #2661

Closed
tsandall opened this issue Aug 26, 2020 · 0 comments
Closed

panic: local variable rewriting corrupts objects #2661

tsandall opened this issue Aug 26, 2020 · 0 comments
Assignees
Labels

Comments

@tsandall
Copy link
Member

The nightly fuzzing job found another crasher. Simplified version:

package test

f(x) = {x[0]: 1} { true }

In this case, the rewriting of 'x' corrupts the object value in the head.

@tsandall tsandall added the bug label Aug 26, 2020
@tsandall tsandall self-assigned this Aug 26, 2020
@tsandall tsandall added this to TODO (Things That Should Be Done) in Open Policy Agent via automation Aug 26, 2020
@tsandall tsandall moved this from TODO (Things That Should Be Done) to In Progress in Open Policy Agent Aug 26, 2020
tsandall added a commit to tsandall/opa that referenced this issue Aug 27, 2020
The local variable rewriting stage was mutating object keys while
iterating over the object itself. This caused the object to become
corrupted. This commit fixes the issue by switching the stage to use
the transformer interface which can safely mutate objects.

The transformer is more expensive because it preemptively copies
terms. If this is an issue, we could special case the transformer
usage to when an object would be mutated.

Fixes open-policy-agent#2661

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Open Policy Agent automation moved this from In Progress to Done Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant