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

Code for os::random() assumes long is 32 bits

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 10
    • hotspot
    • None
    • b21

      The function os::random() uses long but the calculations are for 32 bit random number. The function has been in the code since the beginning.

      os::random() also has a _rand_seed which is modified without thread safety. It doesn't hurt anything since most uses for Symbol are called under the SymbolTable_lock.

      If more multithreaded uses are added, this could hurt the randomness of the value returned.

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: