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

Daniel Huang duke at openjdk.org
Wed Jul 2 20:47:33 UTC 2025


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.

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

Commit messages:
 - Backport 5fab27e1b8fdf2ea27cb3b349bd339a4a6ec828b

Changes: https://git.openjdk.org/jdk17u-dev/pull/3698/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=3698&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8282144
  Stats: 72 lines in 2 files changed: 71 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/3698.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/3698/head:pull/3698

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


More information about the jdk-updates-dev mailing list