RFR: 8306707: Support pluggable image loading via javax.imageio [v9]
Kevin Rushforth
kcr at openjdk.org
Fri Nov 1 17:11:35 UTC 2024
On Wed, 30 Oct 2024 18:32:55 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/iio/bmp/BMPImageLoaderFactory.java line 496:
>>
>>> 494:
>>> 495: int[] outWH = ImageTools.computeDimensions(
>>> 496: bih.biWidth, hght, (int)(w * imagePixelScale), (int)(h * imagePixelScale), preserveAspectRatio);
>>
>> I see possibility of these calculations overflowing.
>
> `ImageTools.computeDimensions()` will not allow the dimensions to be less than 0.
An integer overflow doesn't necessarily cause the result to be negative. I echo Jay's comment, and suggest an explicit check. I note that the code already does that below but doesn't take `pixelScale` into account.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1593#discussion_r1826073649
More information about the openjfx-dev
mailing list