On Mon, 20 Apr 2026 23:59:26 GMT, Phil Race <[email protected]> wrote:

>> The bug was filed to note that the constructor for 
>> MultiPixelPackedSampleModel could throw an odd exception if numberOfBits is 
>> zero.
>> Per the spec this should throw RasterFormatException.
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8381007

src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java 
line 171:

> 169:             throw new IllegalArgumentException("scanlineStride must be > 
> 0");
> 170:         }
> 171:         if (((numberOfBits * w) / DataBuffer.getDataTypeSize(dataType)) 
> > scanlineStride) {

It looks like there might be an integer overflow here:

e.g. `new java.awt.image.MultiPixelPackedSampleModel(3, 77777777, 2, 32, 1, 0)` 
is constructed successfully while it should not.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3115940254

Reply via email to