You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Jon Willeke (JIRA)" <xe...@xml.apache.org> on 2006/10/12 22:25:34 UTC

[jira] Created: (XERCESC-1641) unreachable code in XMLScanner::checkXMLDecl()

unreachable code in XMLScanner::checkXMLDecl()
----------------------------------------------

                 Key: XERCESC-1641
                 URL: http://issues.apache.org/jira/browse/XERCESC-1641
             Project: Xerces-C++
          Issue Type: Bug
          Components: Non-Validating Parser
    Affects Versions: 2.7.0
         Environment: GCC 4.0.1 on PowerPC OS X 10.4.7
            Reporter: Jon Willeke
            Priority: Minor


While investigating a failure in the XML conformance test suite (xmltest/not-wf/sa/154.xml) on IA64 Windows, I stepped through a debug build of SAXPrint and libxerces on OS X.  The document has an XML declaration with an uppercase "XML":

  <?XML version="1.0"?>
  <doc></doc>

The XMLScanner::checkXMLDecl() method in XMLScanner.cpp appears to have a special case to accept this, but emit the XMLErrs::XMLDeclMustBeLowerCase error.  However, this code is not reachable, as it resides within an if statement that looks for lowercase "<?xml."  If I move the test out a level, it is reachable; e.g.:

  if (startWithAngle) {
    if (peekString (fgXMLDeclString))
    {
      if (skippedString (fgXMLDeclStringSpace)
         || ...)
      {
        ...
      }
      /* move from here ... */
    }
    /* ... to here */
    else if (skippedString (fgXMLDeclStringSpaceU)
       || ...)
    {
      ...
    }
  }

As it is, the document is properly rejected with the XMLErrs::NoPIStartsWithXML error, so it may also be acceptable to simply remove the condition.  svn blame is broken (and this code appears to predate svn), but Google helped me find that this condition is an original part of the function, which was added by Tinny Ng in June of 2001, in response to Bugzilla 2257.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Resolved: (XERCESC-1641) unreachable code in XMLScanner::checkXMLDecl()

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESC-1641?page=all ]

Alberto Massari resolved XERCESC-1641.
--------------------------------------

    Resolution: Fixed

A fix is in SVN. Please verify.

Alberto

> unreachable code in XMLScanner::checkXMLDecl()
> ----------------------------------------------
>
>                 Key: XERCESC-1641
>                 URL: http://issues.apache.org/jira/browse/XERCESC-1641
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Non-Validating Parser
>    Affects Versions: 2.7.0
>         Environment: GCC 4.0.1 on PowerPC OS X 10.4.7
>            Reporter: Jon Willeke
>            Priority: Minor
>
> While investigating a failure in the XML conformance test suite (xmltest/not-wf/sa/154.xml) on IA64 Windows, I stepped through a debug build of SAXPrint and libxerces on OS X.  The document has an XML declaration with an uppercase "XML":
>   <?XML version="1.0"?>
>   <doc></doc>
> The XMLScanner::checkXMLDecl() method in XMLScanner.cpp appears to have a special case to accept this, but emit the XMLErrs::XMLDeclMustBeLowerCase error.  However, this code is not reachable, as it resides within an if statement that looks for lowercase "<?xml."  If I move the test out a level, it is reachable; e.g.:
>   if (startWithAngle) {
>     if (peekString (fgXMLDeclString))
>     {
>       if (skippedString (fgXMLDeclStringSpace)
>          || ...)
>       {
>         ...
>       }
>       /* move from here ... */
>     }
>     /* ... to here */
>     else if (skippedString (fgXMLDeclStringSpaceU)
>        || ...)
>     {
>       ...
>     }
>   }
> As it is, the document is properly rejected with the XMLErrs::NoPIStartsWithXML error, so it may also be acceptable to simply remove the condition.  svn blame is broken (and this code appears to predate svn), but Google helped me find that this condition is an original part of the function, which was added by Tinny Ng in June of 2001, in response to Bugzilla 2257.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org