On Thu, 18 Apr 2024 12:01:52 GMT, Oliver Kopp <d...@openjdk.org> wrote:

> Fixes https://bugs.openjdk.org/browse/JDK-8330462.
> 
> If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then 
> an addition of `start` to it leads to a negative value. This is "fixed" by 
> using `Math.max` comparing the `maxLength` and `maxLength + start`.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java
 line 365:

> 363:         if (text == null) return null;
> 364:         validateRange(text);
> 365:         int endOffset = maxLength >= 0 ? Math.min(end, Math.max(start + 
> maxLength, maxLength)) : end;

there is a similar code on LL 101,102,381,485
would we need to apply the same logic there?
possibly in some kind of a utility method?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1442#discussion_r1570948582

Reply via email to