-
Notifications
You must be signed in to change notification settings - Fork 893
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
GODRIVER-1923 Error if BSON cstrings contain null bytes #622
GODRIVER-1923 Error if BSON cstrings contain null bytes #622
Conversation
93e724c
to
78b349d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change LGTM! I just have two questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added validation to panic in bsoncore if a raw document is being constructed directly (e.g. using bsoncore.NewDocumentBuilder
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, just a small question about tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Divjot Arora <divjot.arora@10gen.com>
…mongodb#684) Co-authored-by: Divjot Arora <divjot.arora@10gen.com>
Per bsonspec.org, cstrings are only used for BSON key names and for the pattern/options fields in a BSON regex value so this PR applies validation to those types. This validation does not apply to regular BSON strings, which can have null bytes because they're prefixed with a 4-byte length. It also does not apply to extended JSON because the JSON specification allows null bytes and other unicode code points as long as they are properly escaped (e.g. in JSON, this would look like
{"foo\u0000": "bar"}
.