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

Overflow in Collections.rotate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 8, 11, 17, 21, 22
    • core-libs

      An integer overflow/wraparound in Collections.rotate() can lead to IndexOutOfBoundsException. Reproducer:

          // need something like -Xmx16g
          Collections.rotate(new ArrayList<>(Collections.nCopies((1<<30)+1, "")), 1<<30)

      See the PR for more details:

          https://github.com/openjdk/jdk/pull/15270

            smarks Stuart Marks
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: