[jdk17u-dev] RFR: 8294509: The sign extension bug applies to 'public static int[] convertSeedBytesToInts(byte[] seed, int n, int z)' in RandomSupport

Daniel Huang duke at openjdk.org
Mon Jun 30 17:04:30 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.

Clean backport, ran GHA sanity checks and locally tested tier1, tier2.

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

Commit messages:
 - Merge branch 'openjdk:master' into backport-8294509-RandomSupport-sign-extension
 - Merge branch 'openjdk:master' into backport-8294509-RandomSupport-sign-extension
 - Backport 5a9cd33632862aa2249794902d4168a7fe143054

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

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


More information about the jdk-updates-dev mailing list