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 bu...@apache.org on 2002/02/26 01:14:59 UTC

DO NOT REPLY [Bug 6672] New: - SAXValidator results in an access violation when validating against schema with empty element that has default value

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6672>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6672

SAXValidator results in an access violation when validating against schema with empty element that has default value

           Summary: SAXValidator results in an access violation when
                    validating against schema with empty element that has
                    default value
           Product: Xerces-C++
           Version: 1.6.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: ricky.chan@cgey.com


The following circumstance seems to result in an access violation:

* Use SAX2XMLReader (created by XMLReaderFactory::createXMLReader()) to parser 
an XML message.
* Schema Validation is turned on by setting the following features to true:
	http://xml.org/sax/features/validation
	http://apache.org/xml/features/validation/dynamic
	http://apache.org/xml/features/validation/schema
	http://apache.org/xml/features/validation/schema-full-checking
* A simple specialisation of DefaultHandler is set to the SAX2XMLReader as 
setErrorHandler and setContentHandler.
* Parse a XML message which contains an empty element (e.g. <MagTag/>).
* That empty element has a default value defined in the schema. And that 
element has valid range defined as an enumeration in the schema.
* The message was passed to the parser as a MemBufInputSource.

When it parses the XML message, it results in an access violation.

Looking into the code, the error was coming out from the function call int 
SchemaValidator::checkContent(...), at the following line of code (Line 272 
SchemaValidator.cpp of in Revision 1.26):

getScanner()->getDocHandler()->docCharacters(elemDefaultValue, 
XMLString::stringLen(elemDefaultValue), false);

The access violation was because getScanner()->getDocHandler() returns a null 
pointer.

I ran the program on Win2K using Visual C++ 6 to compile but I believe similar 
problem should appear in other platforms.

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