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

Incorrect size computation at BandedSampleModel.createDataBuffer()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 8, 9, 10
    • client-libs
    • 2d
    • b01
    • generic
    • generic

      . 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.

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

              Created:
              Updated:
              Resolved: