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

Nizar Benalla nbenalla at openjdk.org
Thu Apr 24 14:28:21 UTC 2025


> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - respond to feedback -- keep int[] instead of Arraylist and add check for grow <= 0
 - Merge branch 'master' into jd-ensure
 - fix JdT.ensure

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24620/files
  - new: https://git.openjdk.org/jdk/pull/24620/files/2f09787d..9aaabbfa

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24620&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24620&range=00-01

  Stats: 226308 lines in 1518 files changed: 47238 ins; 175148 del; 3922 mod
  Patch: https://git.openjdk.org/jdk/pull/24620.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24620/head:pull/24620

PR: https://git.openjdk.org/jdk/pull/24620


More information about the compiler-dev mailing list