RFR: 6185110: Undefined behaviour of SampleModel for width, height < 0 [v5]

Phil Race prr at openjdk.org
Tue Nov 25 20:35:39 UTC 2025


On Wed, 15 Oct 2025 08:54:16 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   6185110
>
> src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java line 450:
> 
>> 448: 
>> 449:         if (x < 0 || w < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
>> 450:             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 > height)

fixed

> src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java line 703:
> 
>> 701: 
>> 702:         if (x < 0 || w < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
>> 703:             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 > height)

updated

> src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line 747:
> 
>> 745: 
>> 746:         if (x < 0 || (w < 0) || x >= width || w > width || x1 < 0 || x1 > width ||
>> 747:             y < 0 || (h < 0) || y >= height || y > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || (h < 0) || y >= height || y > height || y1 < 0 || y1 > height)

updated

> src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line 1002:
> 
>> 1000: 
>> 1001:         if (x < 0 || w < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
>> 1002:             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 > height)

updated

> src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java line 460:
> 
>> 458: 
>> 459:         if (x < 0 || w < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
>> 460:             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 > height)

updated

> src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java line 640:
> 
>> 638: 
>> 639:         if (x < 0 || w < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
>> 640:             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
> 
> Suggestion:
> 
>             y < 0 || h < 0 || y >= height || h > height || y1 < 0 || y1 > height)

updated

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561283658
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561301121
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561301852
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561302540
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561303287
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2561303621


More information about the client-libs-dev mailing list