randomization masks #315
midnight-wonderer
started this conversation in
General
Replies: 1 comment
-
Doh, you're absolutely right. Thanks for catching it. I'll make sure that gets fixed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Just audited the C code by @jamis.
I am curious why we use
% 0x1000000
for masking here.https://github.com/mongodb/bson-ruby/blob/ceb72f/ext/bson/init.c#L358
Shouldn't it be
& 0xffffff
so it will be more robust against negative int?From the commit history, both
% 0xffffff
and% 0x1000000
has their own problem; the correct one should be& 0xffffff
, or I am missing something.Beta Was this translation helpful? Give feedback.
All reactions