RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField
Kevin Rushforth
kcr at openjdk.org
Thu Apr 18 15:20:03 UTC 2024
On Thu, 18 Apr 2024 12:01:52 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`.
In addition to the comment Andy made about possible other places for the check, I'd like to see a test, if possible. Also, this doesn't follow the usual pattern of checking for integer overflow, so that could be done in the utility method that Andy suggested.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1442#issuecomment-2064196119
More information about the openjfx-dev
mailing list