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

RUBY-3435 Don't overflow the 4-bytes allotted to an ObjectID's timestamp portion #327

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Apr 5, 2024

This PR ensures that the timestamp is (1) treated as an unsigned integer, to allow the largest possible value there, and (2) truncated to 32 bits (4 bytes) if it ever grows larger than that. This avoids a RangeError that occurs when trying to convert a Bignum to a 32-bit integer internally.

@johnnyshields
Copy link
Contributor

I've run this in my test suite and confirmed that it fixes the bug. Thank you!

@jamis jamis merged commit 79d5aed into mongodb:master Apr 8, 2024
43 checks passed
@jamis jamis deleted the ruby-3435 branch April 8, 2024 14:37
@johnnyshields
Copy link
Contributor

@jamis this is running in production for us now FYI 🎉

@jamis
Copy link
Contributor Author

jamis commented Apr 18, 2024

Wonderful, thanks for the confirmation, @johnnyshields. We'll get it officially released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants