[OpenJDK 2D-Dev] [11] RFR: [JDK-8194489] Incorrect size computation at BandedSampleModel.createDataBuffer

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Sat Jan 6 08:42:51 UTC 2018

Hi, Prahalad.
Not an expert here, but have a small question about implementation of 
this method in the parent class(ComponentSampleModel).
Currently the parent class has a similar implementation of 
createDataBuffer(), but instead of "scanlineStride * height" it uses 
"getBufferSize()". And this "getBufferSize" has a number of additional 
checks, should not we do something similar here as well(see JDK-7058602)?

On 04/01/2018 21:30, Prahalad Kumar Narayanan wrote:
> Request your time to review the fix for the bug:
> JDK-8194489    Incorrect size computation at BandedSampleModel . createDataBuffer
> Root Cause:
> . The method BandedSampleModel . createDataBuffer does not consider number of banks and band offsets while computing the required memory size.
> . As a result, ArrayIndexOutOfBounds exception is thrown when setting pixel values on banded sample models having -
>        . Multiple bands of image data stored in multiple banks of DataBuffer with band offsets
>        . Multiple bands of image data stored in single bank of DataBuffer
> Solution:
> . Appropriate logic has been added to createDataBuffer method.
> Other Info:
> . All Jtreg test-cases in java/awt/image were run with the build including the fix.
> . No regressions were noticed.
> Kindly review the changes at your convenience & share your feedback.
> Link: http://cr.openjdk.java.net/~pnarayanan/8194489/webrev.00/
> Thank you for your time in review
> Have a good day
> Prahalad N.

Best regards, Sergey.

More information about the 2d-dev mailing list