[jdk17u-dev] Integrated: 8282144: RandomSupport.convertSeedBytesToLongs sign extension overwrites previous bytes

Daniel Huang duke at openjdk.org
Tue Jul 8 15:58:52 UTC 2025


On Wed, 2 Jul 2025 18:01:51 GMT, Daniel Huang <duke at openjdk.org> wrote:

> Backport for RandomSupport issue. There is a loss of information when using `convertSeedBytesToLongs()` with a bad seed, causing a lot of the original bytes to be overwritten by 1s. The fix involves using a bitwise AND with the seed before distributing the seed bytes into the result.
> 
> Note there is an exact same issue/bugfix with `convertSeedBytesToInts()`, but I will backport that bugfix separately
> 
> Clean backport, ran GHA sanity checks and locally tested tier1, tier2. In tier2, there were 2 failures:
> `test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java`
> `test/jdk/java/nio/channels/FileChannel/directio/DirectIOTest.java`
> However, these both failed before the backport as well.
> 
> The backport also includes the test for this issue `T8282144.java`, which passes.

This pull request has now been integrated.

Changeset: 8b306de4
Author:    Daniel Huang <dahuangy at amazon.com>
Committer: Paul Hohensee <phh at openjdk.org>
URL:       https://git.openjdk.org/jdk17u-dev/commit/8b306de46d88219722a57f6e72d0b4456eb6faf0
Stats:     72 lines in 2 files changed: 71 ins; 0 del; 1 mod

8282144: RandomSupport.convertSeedBytesToLongs sign extension overwrites previous bytes

Backport-of: 5fab27e1b8fdf2ea27cb3b349bd339a4a6ec828b

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

PR: https://git.openjdk.org/jdk17u-dev/pull/3698


More information about the jdk-updates-dev mailing list