Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8364657

Crash for SecureRandom.generateSeed(0) on Windows x86-64

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 8
    • security-libs
    • None

      Example code:

      ```
      import java.security.SecureRandom;
      import java.util.Arrays;

      public class Test {

          public static void main(String[] args) throws Exception {

              SecureRandom random = SecureRandom.getInstanceStrong();
              System.out.println(Arrays.toString(random.generateSeed(1)));
              System.out.println(Arrays.toString(random.generateSeed(0))); // <-- JVM crashes here

          }

      }

      ```

      Causes JVM to crash on Windows, tested on multiple systems.

      The method generateSeed accepts non-negative integers as input, generateSeed(0) should return byte array of length 0.

      * Works OK on Linux x86, Apple Silicon, Windows on Arm

      JVM crashes. Example output:

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffb622dec9e, pid=30172, tid=15688
      #
      # JRE version: OpenJDK Runtime Environment Temurin-21.0.8+9 (21.0.8+9) (build 21.0.8+9-LTS)
      # Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (21.0.8+9-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
      # Problematic frame:
      # V [jvm.dll+0x44ec9e]
      #
      # No core dump will be written. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\workspaces\...app\hs_err_pid30172.log
      #
      # If you would like to submit a bug report, please visit:
      # https://github.com/adoptium/adoptium-support/issues
      #
      What Java Version are you using?
      openjdk version "21.0.8" 2025-07-15 LTS
      OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (build 21.0.8+9-LTS, mixed mode, sharing)

      Works OK on other Java versions?

      * JRE version: OpenJDK Runtime Environment AdoptOpenJDK (11.0.8+10) (build 11.0.8+10) Java VM: OpenJDK Client VM AdoptOpenJDK (11.0.8+10, mixed mode, serial gc, windows-x86)
      * JRE version: OpenJDK Runtime Environment Temurin-17.0.8+7 (17.0.8+7) (build 17.0.8+7) Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (17.0.8+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)

            semery Shawn Emery
            karianna Martijn Verburg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: