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

Overflow in Collections.rotate

    XMLWordPrintable

Details

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

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: