On Thu, 21 May 2026 17:51:39 GMT, Alexander Zvegintsev <[email protected]> wrote:
>> 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 115: > >> 113: numberOfBits, >> 114: >> (int)(((long)w*numberOfBits+DataBuffer.getDataTypeSize(dataType)-1)/ >> 115: DataBuffer.getDataTypeSize(dataType)), > > It appears that it may throw the wrong exception type if it overflows, e.g. : > > > // OK, RasterFormatException > new Args4(TYPE_BYTE, 1, 1, 16, RasterFormatException.class), > > // FAIL: IllegalArgumentException, scanlineStride must be > 0. > // The 4-arg constructor doesn't mention this case. > // > // Based on the current `@throws` clauses, it could be a > // RasterFormatException: "MultiPixelPackedSampleModel > // does not allow pixels to span data element boundaries", > // which is also possible here. > new Args4(TYPE_BYTE, 1 << 30, 1, 16, RasterFormatException.class), These chained calls can be tricky. I've made checking for overflow a special case here to throw RFE. And added your case to the test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3284734137
