RFR: 8346785: Potential infinite loop in JavadocTokenizer.ensures [v3]

Hannes Wallnöfer hannesw at openjdk.org
Thu Apr 24 15:48:52 UTC 2025


On Thu, 24 Apr 2025 15:24:35 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

>> Please review this patch to fix a potential infinite loop in `JavadocTokenizer.ensure` when `map.length` and `size + need` approach Interger.MAX_VALUE.
>> 
>> While I couldn't reproduce the issue even with large inputs (~1.9GB java file where almost the entire file is one javadoc comment), the fix is about correctness and prevention of UB in extreme cases.
>> 
>> TIA
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   place negative check in correct position

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java line 315:

> 313:             }
> 314: 
> 315:             // Handle overflow.

The overflow check below is now redundant. Would be nice to move the comment up to the new check.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24620#discussion_r2058756938


More information about the compiler-dev mailing list