Integrated: JDK-8273162 AbstractSplittableWithBrineGenerator does not create a random salt

Jim Laskey jlaskey at openjdk.java.net
Fri Sep 10 18:06:54 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) {

This pull request has now been integrated.

Changeset: 5e1df2c7
Author:    Jim Laskey <jlaskey at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/5e1df2c7d71e9393beaa4fd2d8812b065d053392
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8273162: AbstractSplittableWithBrineGenerator does not create a random salt

Reviewed-by: rriggs, bpb

-------------

PR: https://git.openjdk.java.net/jdk/pull/5449


More information about the core-libs-dev mailing list