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
-
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