On Fri, 29 Aug 2025 23:59:54 GMT, Justin Lu <[email protected]> wrote:
> This PR addresses a JCK test failure of an unexpected SIOOBE during
> DecimalFormat parsing. During the char by char comparison in `matchAffix`,
> the minimum of the length of the parsed String and the PP index + affix
> length are iterated on. The parse position index needs to be checked to not
> be negative to ensure that we do not index the String below 0. Taking the
> minimum of those two previously mentioned values already guarantees that we
> do not index the String above the length.
test/jdk/java/text/Format/NumberFormat/LenientParseTest.java line 172:
> 170: assertNull(assertDoesNotThrow(() -> new
> DecimalFormat().parse("1", new ParsePosition(-1))));
> 171: }
> 172:
Thanks for writing the invalid case test. As Alan suggested, maybe we could
provide more edge case tests.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27014#discussion_r2316676697