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=8011>. 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=8011 Parser crashes when using schema val with missing schema file Summary: Parser crashes when using schema val with missing schema file Product: Xerces-C++ Version: 1.7.0 Platform: Sun OS/Version: Solaris Status: NEW Severity: Critical Priority: Other Component: Validating Parser (Schema) (Xerces 1.5 or up only) AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Using the Sun's compiler when built as normal optimized code -O level (CC: Sun WorkShop 6 update 1 C++ 5.2 Patch 109508-02 2001/03/04), the SAX2 parser crashes. Here is the sample program: ... SAX2XMLReader* parser = XMLReaderFactory::createXMLReader(); XMLCh *val = XMLString::transcode("http://xml.org/sax/features/validation"); XMLCh *schema = XMLString::transcode("http://apache.org/xml/features/validation/schema"); XMLCh *full = XMLString::transcode("http://apache.org/xml/features/validation/schema-full-checking"); parser->setFeature( val, true); parser->setFeature( schema, true); parser->setFeature( full, true); parser->setExitOnFirstFatalError( true ); parser->setValidationConstraintFatal( true ); MemBufInputSource* memBufIS = new MemBufInputSource ((const XMLByte*)buf, "/path/to/asd/", false); memBufIS->setIssueFatalErrorIfNotFound( true ); WAS_XMLSAX2Handler handler("UTF-8", XMLFormatter::UnRep_CharRef, false); try { parser->setContentHandler(&handler); parser->setErrorHandler(&handler); parser->parse( *memBufIS ); errorCount = parser->getErrorCount(); } catch (const XMLException& toCatch) { cerr << "\nAn error occured\n Error: " << endl; XMLPlatformUtils::Terminate(); return 4; } The buf used in the MemBufInputSource was new'ed and read from a file. Sample .xsd file (cancelOrderTrans.xsd): <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="CANCELORDERTRANS"> <xs:annotation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="CANCELORDER"> <xs:annotation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="DUEDT"> <xs:annotation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:date"> <xs:pattern value="\d\d\d\d-\d\d-\d\d"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="JURISDICTIONCD"> <xs:annotation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="2"/> <xs:enumeration value="MD"/> <xs:enumeration value="DC"/> <xs:enumeration value="VA"/> <xs:enumeration value="WV"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="LOGONCD"> <xs:annotation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="10"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="SERVICEREQUESTID"> <xs:annotation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="1"/> <xs:maxInclusive value="999999999"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="STATUSCD"> <xs:annotation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="2"/> <xs:enumeration value="CA"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="CSABBID" type="xs:integer"> <xs:annotation> </xs:annotation> </xs:element> <xs:element name="CSAOPID" type="xs:integer"> <xs:annotation> </xs:annotation> </xs:element> <xs:element name="CSAREPLYOPID" type="xs:integer"> <xs:annotation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Sample XML test.xml: <?xml version="1.0" encoding="UTF-8" ?><CANCELORDERTRANS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XXcancelOrderTrans.xsd" > <CANCELORDER> <DUEDT>2002-03-15</DUEDT> <JURISDICTIONCD>VA</JURISDICTIONCD> <LOGONCD>babcdef</LOGONCD> <SERVICEREQUESTID>777666777</SERVICEREQUESTID> <STATUSCD>CA</STATUSCD> </CANCELORDER> <CSABBID>4410</CSABBID> <CSAOPID>28503</CSAOPID> <CSAREPLYOPID>28503</CSAREPLYOPID> </CANCELORDERTRANS> Stack Trace from dbx with above example, sorry it's optimized: [1] XMLReader::~XMLReader(0x320050, 0x7, 0x1fdc14, 0x0, 0xffbeccd4, 0x1fdcb8), at 0x8766c [2] ReaderMgr::reset(0x26f664, 0x7, 0x1fde18, 0x289360, 0x0, 0x0), at 0xb6a78 [3] XMLScanner::scanDocument(0x2729c0, 0x24f6c0, 0x0, 0x0, 0x21fb8, 0xff345878), at 0x8ac18 [4] IDOMParser::parse(0xffbedf70, 0x24f6c0, 0x0, 0xff358c84, 0xff3592cc, 0x1), at 0xaf62c [5] XMLScanner::resolveSchemaGrammar(0xffbedf70, 0x0, 0x1fdcb8, 0x27281c, 0x2727aa, 0x1fdbcc), at 0x94e6c [6] XMLScanner::scanRawAttrListforNameSpaces(0x22e42a, 0x22e47c, 0x2, 0x251498, 0x2, 0x1fd5d6), at 0x94984 [7] XMLScanner::scanStartTagNS(0x0, 0xffbee187, 0x250ef8, 0x0, 0x1, 0x251408), at 0x8eef8 [8] XMLScanner::scanContent(0x2513c0, 0x0, 0x1eb2f0, 0x1b97a0, 0x1fd5d4, 0xff1c1524), at 0x8ccec [9] XMLScanner::scanDocument(0x2513c0, 0x256c08, 0x0, 0x3e, 0x0, 0x0), at 0x8a900 [10] SAX2XMLReaderImpl::parse(0x2512b8, 0x256c08, 0x2513c0, 0x2512b8, 0x0, 0x1), at 0x7d8c4 =>[11] main(argC = 4, argV = 0xffbef38c), line 78 in "SAX2Print.cc" This does NOT crash when built debug. It's either a bug with the Sun optimizer or an odd un-initialized variable in XERCES-C. I did make a change to XMLScanner.cpp and got around the crash, but I am not sure this was the right thing to do. I removed the call to fReaderMgr.reset(); on line 539 of XMLScanner.cpp. In looking at the crash stack trace, I don't like the 0x7 being passed to this function ReaderMgr::reset. I appears to me like something was already destroyed. I tried the same example on Linux with gcc 2.96 optimized with no crash. Any thoughts? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]