[DocCommentParser] Infinite loop while looking for the end of a preamble

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 16
    • Affects Version/s: 16
    • Component/s: tools
    • b12

      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
      @@ -707,14 +707,14 @@ public class DocCommentParser {
                           case "body":
                               // Check if also followed by <main>
                               // 1. skip rest of <body>
      - while (ch != -1 && ch != '>') {
      + while (bp < buflen && ch != '>') {
                                   nextChar();
                               }
                               if (ch == '>') {
                                   nextChar();
                               }
                               // 2. skip any whitespace
      - while (ch != -1 && Character.isWhitespace(ch)) {
      + while (bp < buflen && Character.isWhitespace(ch)) {
                                   nextChar();
                               }
                               // 3. check if looking at "<main..."

            Assignee:
            Pavel Rappo
            Reporter:
            Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: