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

pit b77: regression: got IndexOutOfBoundsException from BufferedInputStream during seed generation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 6
    • core-libs
    • b78
    • generic
    • solaris
    • Verified

      There is not problem when running the following code with promotion build 75.
      But with pit build 77, we got the following exception on sol9, sol10, sol10 64bit, sol9x86, sol10x86
      Exception in thread "main" java.lang.IndexOutOfBoundsException
              at java.io.BufferedInputStream.read(BufferedInputStream.java:340)
              at java.io.BufferedInputStream.fill(BufferedInputStream.java:225)
              at java.io.BufferedInputStream.read1(BufferedInputStream.java:290)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:363)
              at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedByte(SeedGenerator.java:453)
              at sun.security.provider.SeedGenerator.getSeedBytes(SeedGenerator.java:123)
              at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:118)
              at sun.security.provider.SecureRandom.engineGenerateSeed(SecureRandom.java:114)
              at java.security.SecureRandom.generateSeed(SecureRandom.java:495)
              at Test.main(Test.java:11)

      -----------------
      import java.security.* ;

      public class Test
      {
         static byte[] rnd ;

         static public void main (String[] args) throws Exception {
            System.out.println (
      "Generating 20,000 random bits. This will take SOME time...") ;
            
            rnd = (SecureRandom.getInstance("SHA1PRNG")).generateSeed(2500) ;

            System.out.println ("Done.") ;
            
         }
      }
      -------------------------------
      The test is passed when the numBytes passed in is equal or less than 1040.
      And it will be failed when the numBytes passed in is equal or bigger that 1041.

            chegar Chris Hegarty
            lzhanorcl Lichun Zhan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: