Bug in AgentWriter.write(int) can cause TCK failures

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • jt5.0
    • Affects Version/s: jt3.2.1
    • Component/s: tools
    • fcs
    • b36
    • other
    • other
    • Verified

      CDC-HI bug #6414216 is a result of a bug in javatest. The CDC TCK exceptions03103.java test intentionally is recursive until a StackOverflowError is reached. On each recursive call, it does a out.println, with data like the following:

      ...
      Test at depth 3216
      Test at depth 3217
      Test at depth 3218
      Test at depth 3219
      Test at depth 3220
      Test at depth 3221
      Test at depth 3222
      Test at depth 3223
      ...

      The out.println call eventually ends up in AgentWriter.write(int ch), which does the following:

          public synchronized void write(int ch) throws IOException {
      buf[count++] = (char)ch;
      if (count == buf.length) {
      parent.sendChars(type, buf, 0, count);
      count = 0;
      }
          }

      Because the TCK test is trying to force a StackOverflowError, there is a very good chance that one can happen during the call to parent.sendChars. If it does, then count is never reset to 0, so the next time write(int ch) is called you get an ArrayIndexOutOfBoundsException. count should be reset to 0 before the sendChars() call.

            Assignee:
            Alexey Fedorchenko (Inactive)
            Reporter:
            Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: