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

Prevent casting null or undefined UUID field value #13029

Merged
merged 3 commits into from Feb 15, 2023
Merged

Prevent casting null or undefined UUID field value #13029

merged 3 commits into from Feb 15, 2023

Conversation

Freezystem
Copy link
Contributor

Summary

In binaryToString function (line 67), return the falsy (e.g: null or undefined) value instead of trying to cast it to string.

Optional modifications:

  • in hex2buffer function (line 24), check for falsy hex before trying to cast it to a Buffer.
  • in binary2hex function (line 37), check for falsy buf before trying to generate hexadecimal string from it.

Examples

related to #13025

In `binaryToString` function (line 67), return the _falsy_ (e.g: `null` or `undefined`) value instead of trying to cast it to string.

Optional modifications:
- in `hex2buffer` function (line 24), check for _falsy_ `hex` before trying to cast it to a `Buffer`.
- in `binary2hex` function (line 37), check for _falsy_ `buf` before trying to generate hexadecimal string from it.

related to #13025
@Freezystem Freezystem changed the title Prevent casting null or undefined field value Prevent casting null or undefined UUID field value Feb 13, 2023
@Freezystem
Copy link
Contributor Author

Sorry I don't know if written tests are sufficient enough as I can't run them locally because of a Mongo Memory error.

@vkarpov15 vkarpov15 added this to the 6.9.2 milestone Feb 15, 2023
@vkarpov15 vkarpov15 merged commit 06585a8 into Automattic:master Feb 15, 2023
@Freezystem Freezystem deleted the patch-2 branch February 15, 2023 22:09
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