Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53016

IndexOutOfBoundsException in MarkupText caused by (Model)HyperlinkNote

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None

      Very similar to JENKINS-23697, but caused by creating a hyperlink note where the link text contains newline characters. When the note is encoded, the newlines count towards the length, but when the note is being read back via ConsoleAnnotationOutputStream, the data is split at each newline, so the length encoded in the note does not match what the stream sees, causing the IndexOutOfBoundsException.

      One way this could happen is if a build's display name is edited by a user to contain newlines, and then that build is passed to ModelHyperlinkNote#encodeTo. A workaround in that case would be to remove the newlines from the build's display name.

      Here is an example stack trace of the problem:

      java.lang.IndexOutOfBoundsException
      	at hudson.MarkupText.rangeCheck(MarkupText.java:276)
      	at hudson.MarkupText.addMarkup(MarkupText.java:259)
      	at hudson.console.HyperlinkNote.annotate(HyperlinkNote.java:69)
      	at hudson.console.ConsoleAnnotationOutputStream$1.annotate(ConsoleAnnotationOutputStream.java:115)
      	at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:145)
      	at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
      	at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
      	at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
              ...
      

          [JENKINS-53016] IndexOutOfBoundsException in MarkupText caused by (Model)HyperlinkNote

          Devin Nusbaum created issue -
          Devin Nusbaum made changes -
          Link New: This issue relates to JENKINS-23697 [ JENKINS-23697 ]
          Devin Nusbaum made changes -
          Remote Link New: This issue links to "jenkinsci/jenkins#3580 (Web Link)" [ 21314 ]
          Devin Nusbaum made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Devin Nusbaum made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Devin Nusbaum made changes -
          Description Original: Very similar to JENKINS-23697, but caused by creating a hyperlink note where the link text contains newline characters. When the note is encoded, the newlines count towards the length, but when the note is being read back via ConsoleAnnotationOutputStream, the data is split at each newline, so the length encoded in the note does not match what the stream sees, causing the IndexOutOfBoundsException.

          One way this could happen is if a build's display name is edited by a user to contain newlines, and then that build is passed to {{ModelHyperlinkNote#encodeTo}}.

          Here is an example stack trace of the problem:

          {noformat}
          java.lang.IndexOutOfBoundsException
          at hudson.MarkupText.rangeCheck(MarkupText.java:276)
          at hudson.MarkupText.addMarkup(MarkupText.java:259)
          at hudson.console.HyperlinkNote.annotate(HyperlinkNote.java:69)
          at hudson.console.ConsoleAnnotationOutputStream$1.annotate(ConsoleAnnotationOutputStream.java:115)
          at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:145)
          at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
          {noformat}
          New: Very similar to JENKINS-23697, but caused by creating a hyperlink note where the link text contains newline characters. When the note is encoded, the newlines count towards the length, but when the note is being read back via ConsoleAnnotationOutputStream, the data is split at each newline, so the length encoded in the note does not match what the stream sees, causing the IndexOutOfBoundsException.

          One way this could happen is if a build's display name is edited by a user to contain newlines, and then that build is passed to {{ModelHyperlinkNote#encodeTo}}. A workaround in that case would be to remove the newlines from the build's display name.

          Here is an example stack trace of the problem:

          {noformat}
          java.lang.IndexOutOfBoundsException
          at hudson.MarkupText.rangeCheck(MarkupText.java:276)
          at hudson.MarkupText.addMarkup(MarkupText.java:259)
          at hudson.console.HyperlinkNote.annotate(HyperlinkNote.java:69)
          at hudson.console.ConsoleAnnotationOutputStream$1.annotate(ConsoleAnnotationOutputStream.java:115)
          at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:145)
          at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
          {noformat}
          Devin Nusbaum made changes -
          Description Original: Very similar to JENKINS-23697, but caused by creating a hyperlink note where the link text contains newline characters. When the note is encoded, the newlines count towards the length, but when the note is being read back via ConsoleAnnotationOutputStream, the data is split at each newline, so the length encoded in the note does not match what the stream sees, causing the IndexOutOfBoundsException.

          One way this could happen is if a build's display name is edited by a user to contain newlines, and then that build is passed to {{ModelHyperlinkNote#encodeTo}}. A workaround in that case would be to remove the newlines from the build's display name.

          Here is an example stack trace of the problem:

          {noformat}
          java.lang.IndexOutOfBoundsException
          at hudson.MarkupText.rangeCheck(MarkupText.java:276)
          at hudson.MarkupText.addMarkup(MarkupText.java:259)
          at hudson.console.HyperlinkNote.annotate(HyperlinkNote.java:69)
          at hudson.console.ConsoleAnnotationOutputStream$1.annotate(ConsoleAnnotationOutputStream.java:115)
          at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:145)
          at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
          {noformat}
          New: Very similar to JENKINS-23697, but caused by creating a hyperlink note where the link text contains newline characters. When the note is encoded, the newlines count towards the length, but when the note is being read back via ConsoleAnnotationOutputStream, the data is split at each newline, so the length encoded in the note does not match what the stream sees, causing the IndexOutOfBoundsException.

          One way this could happen is if a build's display name is edited by a user to contain newlines, and then that build is passed to {{ModelHyperlinkNote#encodeTo}}. A workaround in that case would be to remove the newlines from the build's display name.

          Here is an example stack trace of the problem:

          {noformat}
          java.lang.IndexOutOfBoundsException
          at hudson.MarkupText.rangeCheck(MarkupText.java:276)
          at hudson.MarkupText.addMarkup(MarkupText.java:259)
          at hudson.console.HyperlinkNote.annotate(HyperlinkNote.java:69)
          at hudson.console.ConsoleAnnotationOutputStream$1.annotate(ConsoleAnnotationOutputStream.java:115)
          at hudson.console.ConsoleAnnotationOutputStream.eol(ConsoleAnnotationOutputStream.java:145)
          at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
          at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
                  ...
          {noformat}
          Devin Nusbaum made changes -
          Devin Nusbaum made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]
          Devin Nusbaum made changes -
          Link New: This issue relates to JENKINS-53729 [ JENKINS-53729 ]

            dnusbaum Devin Nusbaum
            dnusbaum Devin Nusbaum
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: