jaxp
  1. jaxp
  2. JAXP-68

Infinite do-while loop in XMLDocumentScannerImpl$PrologDriver.next

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      68

      Description

      It appears that the do-while loop in XMLDocumentScannerImpl$PrologDriver.next
      causes an infinite loop since there are if-else conditions that do not change
      the "scanner state". Similar code in XercesJ-2
      XMLDocumentScannerImpl$PrologDispather.dispatch appears to have corrected the
      problem.

      Partial thread dump from JDK 1.6.0_15 (although current source code in JAXP
      1.4.4 does not appear to have changed):
      "validateClockAction-9197" daemon prio=10 tid=0x00002aab84013800 nid=0x780f
      runnable [0x00000000414a6000]
      java.lang.Thread.State: RUNNABLE
      at
      com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next
      (XMLDocumentScannerImpl.java:931)
      at
      com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next
      (XMLDocumentScannerImpl.java:648)
      at
      com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
      (XMLNSDocumentScannerImpl.java:140)
      at
      com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next
      (XMLStreamReaderImpl.java:548)
      at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke
      (ReadHeadersHandler.java:44)

      Source excerpt from JAXP:
      do {
      switch (fScannerState) {
      case SCANNER_STATE_PROLOG: {
      fEntityScanner.skipSpaces();
      if (fEntityScanner.skipChar('<'))

      { setScannerState(SCANNER_STATE_START_OF_MARKUP); }

      else if (fEntityScanner.skipChar('&'))

      { setScannerState(SCANNER_STATE_REFERENCE); }

      else

      { setScannerState(SCANNER_STATE_CONTENT); }

      break;
      }

      case SCANNER_STATE_START_OF_MARKUP: {
      fMarkupDepth++;

      if (fEntityScanner.skipChar('?'))

      { setScannerState(SCANNER_STATE_PI); }

      else if (fEntityScanner.skipChar('!')) {
      if (fEntityScanner.skipChar('-')) {
      if (!fEntityScanner.skipChar('-'))

      { reportFatalError("InvalidCommentStart", null); }

      setScannerState(SCANNER_STATE_COMMENT);
      } else if (fEntityScanner.skipString(DOCTYPE)) {
      setScannerState(SCANNER_STATE_DOCTYPE);
      Entity entity =
      fEntityScanner.getCurrentEntity();
      if(entity instanceof Entity.ScannedEntity)

      { fStartPos=((Entity.ScannedEntity) entity).position; }

      fReadingDTD=true;
      if(fDTDDecl == null)
      fDTDDecl = new XMLStringBuffer();
      fDTDDecl.append("<!DOCTYPE");

      } else

      { reportFatalError ("MarkupNotRecognizedInProlog", null); >>>>>no change in fScannerState }

      } else if (XMLChar.isNameStart
      (fEntityScanner.peekChar()))

      { setScannerState(SCANNER_STATE_ROOT_ELEMENT); setDriver(fContentDriver); //from now onwards this would be handled by fContentDriver,in the same next() call return fContentDriver.next(); }

      else

      { reportFatalError("MarkupNotRecognizedInProlog", null); >>>>>no change in fScannerState }

      break;
      }
      }
      } while (fScannerState == SCANNER_STATE_PROLOG || fScannerState
      == SCANNER_STATE_START_OF_MARKUP );

        Activity

        stevehale created issue -
        kenaiadmin made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 68 46752

          People

          • Assignee:
            jaxp-issues
            Reporter:
            stevehale
          • Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: