[jdk17u-dev] Integrated: 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
Fri Jul 11 15:59:45 UTC 2025


On Tue, 8 Jul 2025 16:15:48 GMT, Daniel Huang <duke at openjdk.org> wrote:

> Backport for RandomSupport issue. There is a loss of information when using `convertSeedBytesToInts()` 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. In tier2, there was 1 failure:
> `test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java`
> However, this fails on master as well.
> 
> The backport also updates the test `T8282144.java` to test for ints as well, which passes.

This pull request has now been integrated.

Changeset: d9fa9cf8
Author:    Daniel Huang <dahuangy at amazon.com>
Committer: Paul Hohensee <phh at openjdk.org>
URL:       https://git.openjdk.org/jdk17u-dev/commit/d9fa9cf83979d91845f238e19dc3438972be59ee
Stats:     41 lines in 2 files changed: 39 ins; 0 del; 2 mod

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

Backport-of: 5a9cd33632862aa2249794902d4168a7fe143054

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

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


More information about the jdk-updates-dev mailing list