On Wed, 30 Oct 2024 18:32:55 GMT, Michael Strauß <mstra...@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

Reply via email to