RFR: JDK-8273162 AbstractSplittableWithBrineGenerator does not create a random salt
Brian Burkhalter
bpb at openjdk.java.net
Fri Sep 10 17:58:48 UTC 2021
On Thu, 9 Sep 2021 18:01:04 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
> RandomSupport.AbstractSplittableWithBrineGenerator. makeSplitsSpliterator is intending to create a salt from a random long. The salt should have random letters of size 4 for each consecutive 4 bits and then the last 4 bits as ff, i.e. all bits set.
>
> However the loop is never executed, the random bits are not used and the salt is always the same.
>
> This condition is false on the first execution:
>
> long multiplier = (1L << SALT_SHIFT) - 1;
> long salt = multiplier << (64 - SALT_SHIFT);
> while ((salt & multiplier) != 0) {
>
>
> This can be corrected by changing:
>
> while ((salt & multiplier) != 0) {
>
> to
>
> while ((salt & multiplier) == 0) {
Marked as reviewed by bpb (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/5449
More information about the core-libs-dev
mailing list