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

GODRIVER-1918 Check for zero length in readstring #613

Merged
merged 1 commit into from Mar 24, 2021

Conversation

@benjirewis
Copy link
Collaborator

@benjirewis benjirewis commented Mar 17, 2021

GODRIVER-1918

Adds a check for zero length strings in readstring to ensure that a malformed string such as {0x0, 0x0, 0x0, 0x0} will not panic with StringValue() and StringValueOk().

Adds two new tests to verify no panic in the case of zero-length strings.

@benjirewis benjirewis requested review from iwysiu and divjotarora Mar 17, 2021
iwysiu
iwysiu approved these changes Mar 17, 2021
@benjirewis
Copy link
Collaborator Author

@benjirewis benjirewis commented Mar 19, 2021

In case anyone is curious, a BSON string can never have length 0. An empty string in BSON is represented as 0x1, 0x0, 0x0, 0x0, 0x0 in bytes.

@benjirewis benjirewis requested a review from kevinAlbs Mar 22, 2021
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

LGTM!

@benjirewis benjirewis merged commit 801470d into mongodb:master Mar 24, 2021
15 checks passed
@benjirewis benjirewis deleted the stringValuePanic.1918 branch Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants