On Fri, 22 May 2026 18:40:08 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 124:

> 122:         if (dataType < DataBuffer.TYPE_BYTE ||
> 123:             (dataType > DataBuffer.TYPE_DOUBLE &&
> 124:              dataType != DataBuffer.TYPE_UNDEFINED))

Why the TYPE_UNDEFINED is accepted? it will throw an exception a few line below 
when `DataBuffer.getDataTypeSize` be called.

test/jdk/java/awt/image/MultiPixelPackedSampleModelConstructor.java line 48:

> 46:         }
> 47: 
> 48:        // Also verify createSubsetSampleModel ignores bands.

might be useful just to pass null?

test/jdk/java/awt/image/MultiPixelPackedSampleModelConstructor.java line 90:

> 88:         new Args6(TYPE_INT, 1, 1, 16, 1, 0, null),
> 89:         new Args6(TYPE_BYTE, 1, 30, 0, 4, 0, RasterFormatException.class),
> 90:         new Args6(TYPE_BYTE, 0, 1, 4, 1, 0, 
> IllegalArgumentException.class),

it seems h = 0 and h < 0 and not checked?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3307453577
PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3307466826
PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3307463521

Reply via email to