On Mon, 4 May 2026 21:21:21 GMT, Phil Race <[email protected]> wrote:
>> Better up-front validation of some out of bounds parameters.
>>
>> ---------
>> - [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:
>
> 8383605
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/java/awt/image/Raster.java line 204:
> 202: * both > 0
> 203: * @throws IllegalArgumentException if the product of {@code w}
> 204: * {@code h} and {@code bands} is greater than {@code
> Integer.MAX_VALUE}
Since there are three arguments to multiplication now, a comma is required
after `{@code w}`, otherwise it will look odd: “if the product of `w` `h` and
`bands`…
src/java.desktop/share/classes/java/awt/image/Raster.java line 228:
> 226: if (slsz > Integer.MAX_VALUE) {
> 227: throw new IllegalArgumentException("width * bands is too
> large");
> 228: }
Is it still possible that `w*h*bands > Integer.MAX_VALUE` while neither `w*h`
nor `w*bands` overflow?
-------------
PR Review: https://git.openjdk.org/jdk/pull/31014#pullrequestreview-4229442033
PR Review Comment: https://git.openjdk.org/jdk/pull/31014#discussion_r3189632650
PR Review Comment: https://git.openjdk.org/jdk/pull/31014#discussion_r3189646705