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

cty: AsBigFloat does a shallow copy #114

Merged
merged 1 commit into from Aug 17, 2021

Conversation

jbardin
Copy link
Contributor

@jbardin jbardin commented Aug 4, 2021

Use Float.Copy in AsBigFloat to ensure that there is no shared data
between the mutable *big.Float and the cty.Value internal state.

Without the Copy, the given test will output:

original value changed from cty.NumberFloatVal(1.9) to cty.NumberIntVal(1)

Use Float.Copy in AsBigFloat to ensure that there is no shared data
between the mutable `*big.Float` and the `cty.Value` internal state.
Copy link
Collaborator

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

Hah, nice catch! I guess callers could (and did) mutate our internal state after all. 🙃

Thanks for fixing this.

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.

None yet

2 participants