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

Incorrect size computation at BandedSampleModel.createDataBuffer()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9, 10
    • Fix Version/s: 11
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • Resolved In Build:
      b01
    • CPU:
      generic
    • OS:
      generic

      Description

      . BandedSampleModel . createDataBuffer computes the size & allocates DataBuffer as
           int size = scanlineStride * height;
           dataBuffer = new DataBuffer<Type>(size, numBanks);

      . This holds good if the BandedSampleModel contains mulitple banks.
      . If the BandedSampleModel contains only one bank to store all the bands, the computed size will not suffice and cause ArrayIndexOutOfBounds exception.

      . For Example:
        Consider a 3 x 3 BandedSampleModel with 1 Bank and 3 Bands
        The DataBuffer would be- RRRRRRRRRGGGGGGGGGBBBBBBBBB
        The size required is 27 DataBuffer array elements.
        The size as computed in existing logic would be (scanline stride) 3 * 3 (height) = 9 array elements.

        Attachments

          Activity

            People

            • Assignee:
              pnarayanan Prahalad Kumar Narayanan (Inactive)
              Reporter:
              pnarayanan Prahalad Kumar Narayanan (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: