RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v5]
Kevin Rushforth
kcr at openjdk.org
Thu Apr 18 22:11:01 UTC 2024
On Thu, 18 Apr 2024 21:27:12 GMT, Oliver Kopp <duke at 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`.
>
> Oliver Kopp has updated the pull request incrementally with one additional commit since the last revision:
>
> start should be at most maxEnd
I left one inline comment.
I'd like @arapte to review this, since he is familiar with this code, having fixed other IOOBE bugs in it.
Reviewers: @arapte @andy-goryachev-oracle
modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java line 101:
> 99:
> 100: int length = text.length();
> 101: start = getValidStringIndex(start, 0, length);
This change doesn't seem necessary. There is no possibility of integer overflow here.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1442#pullrequestreview-2009986037
PR Comment: https://git.openjdk.org/jfx/pull/1442#issuecomment-2065411004
PR Review Comment: https://git.openjdk.org/jfx/pull/1442#discussion_r1571433383
More information about the openjfx-dev
mailing list