RFR: 8376510: Raster.createBandedRaster(int, int, int, int, int[], int[], Point) does not check for negative scanlineStride

Sergey Bylokhov serb at openjdk.org
Wed Jan 28 19:23:07 UTC 2026


On Tue, 27 Jan 2026 19:04:04 GMT, Phil Race <prr at openjdk.org> 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


More information about the client-libs-dev mailing list