On Wed, 28 Jan 2026 19:20:01 GMT, Sergey Bylokhov <[email protected]> wrote:
>> We specify that scanlineStride < 0 will throw IAE, but it was not checked up
>> front in all cases, so sometimes would be IAE and sometimes
>> NegativeArrayIndexException.
>> Add an explicit check.
>
> src/java.desktop/share/classes/java/awt/image/Raster.java line 458:
>
>> 456: throw new IllegalArgumentException("Scanline stride must be
>> >= 0");
>> 457: }
>> 458: if (bankIndices == null) {
>
> The JDK-8369129 changed some checks from "scanlineStride < 0" to
> "scanlineStride <= 0". Should not we do the same here?
This specific case (BandedSampleModel) was one of those noted in the PR for
that bug
https://github.com/openjdk/jdk/pull/27627#discussion_r2429979263
and as I noted they require careful consideration before changing.
This change doesn't preclude also disallowing 0 at a later time, with proper
consideration, but the sole goal here is to ensure that negative values are
always disallowed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29454#discussion_r2738466119