On Mon, 18 May 2026 23:58:14 GMT, Sergey Bylokhov <[email protected]> wrote:
>> The second constructor can get overflow in intermediate calculation as well:
>> new MultiPixelPackedSampleModel(TYPE_BYTE, 1<<29, 1, 4, 1<<28, 0);
>> new MultiPixelPackedSampleModel(TYPE_BYTE, 1<<29, 1, 4);
>> both should end in the same MultiPixelPackedSampleModel, but 4arg
>> constructor thrown an exception.
>>
>> Also the new javadoc should probably include the casts used in the code?
>>
>> * @throws RasterFormatException if
>> * {@code ((numberOfBits * w) +
>> DataBuffer.getDataTypeSize(dataType) - 1)
>
> We probably should check the math in the
> MultiPixelPackedSampleModel.createDataBuffer() as well.
I can't find where you made these comments inline so replying here.
I've updated the code for the calculation and added these to the test.
I don't see a problem with createDataBuffer since it is using the values from
this SM which should already be validated.
Probably it should be a separate bug anyway if there is an issue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3262900050