Re: RFR: 8376510: Raster.createBandedRaster(int, int, int, int, int[], int[], Point) does not check for negative scanlineStride
On Tue, 27 Jan 2026 19:04:04 GMT, Phil Race 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. Marked as reviewed by azvegint (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/29454#pullrequestreview-3723337153
Re: RFR: 8376510: Raster.createBandedRaster(int, int, int, int, int[], int[], Point) does not check for negative scanlineStride
On Tue, 27 Jan 2026 19:04:04 GMT, Phil Race 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. Marked as reviewed by serb (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/29454#pullrequestreview-3719145145
Re: RFR: 8376510: Raster.createBandedRaster(int, int, int, int, int[], int[], Point) does not check for negative scanlineStride
On Wed, 28 Jan 2026 19:20:01 GMT, Sergey Bylokhov 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
Re: RFR: 8376510: Raster.createBandedRaster(int, int, int, int, int[], int[], Point) does not check for negative scanlineStride
On Tue, 27 Jan 2026 19:04:04 GMT, Phil Race 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?
-
PR Review Comment: https://git.openjdk.org/jdk/pull/29454#discussion_r2738201423
