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

fix(NODE-3021): fix a long standing bug in Decimal128.fromString() #458

Merged
merged 2 commits into from
Sep 9, 2021

Conversation

tzhuan
Copy link
Contributor

@tzhuan tzhuan commented Sep 8, 2021

Description

Fix a long standing bug in Decimal128.fromString()

What changed?

The representation string was wrongly used to find the significant digits. The digits array should be used instead.

Note that the v2.0 and v3.0 branches also have this bug.

@tzhuan tzhuan changed the title Fix a long standing bug in Decimal128.fromString() fix(NODE-3021): fix a long standing bug in Decimal128.fromString() Sep 8, 2021
@dariakp dariakp added the tracked-in-jira There is a ticket in Mongo's Jira instance tracking this issue/PR label Sep 8, 2021
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Thank you for submitting this fix, I just have a suggestion for a few more test cases around the leading/trailing zero

test/node/decimal128_tests.js Show resolved Hide resolved
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

LGTM including the suggested tests, Thanks again!

@dariakp dariakp merged commit 824939a into mongodb:master Sep 9, 2021
@tzhuan
Copy link
Contributor Author

tzhuan commented Sep 10, 2021

Thank you!

Hope that you can make a new bson npm release (and also a new mongodb node driver npm release) as soon as possible because this bug is potentially a significant vulnerability especially for financial usages.

@tzhuan tzhuan deleted the bugfix-decimal128-from-string branch September 10, 2021 02:19
@dariakp
Copy link
Contributor

dariakp commented Sep 10, 2021

@tzhuan Yes, we are definitely planning to do a release soon. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracked-in-jira There is a ticket in Mongo's Jira instance tracking this issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants