Skip to content

GODRIVER-2311 Ensure unmarshaled BSON values always use distinct unde… #892

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

Merged
merged 2 commits into from
Apr 4, 2022

Conversation

kevinAlbs
Copy link
Contributor

…rlying byte arrays. (#874)

Background & Motivation

Backporting to 1.7.0 is against the policy of backporting to the most recent minor release. Backporting to 1.7.0 intends to provide this fix to the majority of active Go driver users.

The other tests from d307af8 are not cherry-picked since they were made after additional changes to unmarshal_test.go and unmarshal_cases_test.go in c918d8c.

There is no Evergreen project tracking the release/1.7 branch. But here is a patch build with one task running tests in the bson package.

Summary

  • Cherry-pick the fix of d307af8.
  • Cherry-pick the TestUnmarshalByteSlicesUseDistinctArrays test.

return vr.d[start : start+int64(length)], nil

b := make([]byte, length)
copy(b, vr.d[start:start+int64(length)])
Copy link
Contributor

Choose a reason for hiding this comment

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

Depending on the result of #891, this copy may be moved to the ReadBinary function (cc @matthewdale), in which case we should probably do the same on the release/1.7 branch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just opened #891 for review. Agreed we should review that before back-porting this fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the heads up. I have added the commit onto this PR.

@kevinAlbs
Copy link
Contributor Author

kevinAlbs commented Mar 31, 2022

Here is the second patch build with one task running tests in the bson package.

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@kevinAlbs kevinAlbs merged commit 8e61246 into mongodb:release/1.7 Apr 4, 2022
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.

3 participants