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 xe...@xml.apache.org on 2004/10/19 18:29:52 UTC
[jira] Closed: (XERCESC-416) Parser crashes when using schema val with missing schema file
Message:
The following issue has been closed.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XERCESC-416
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XERCESC-416
Summary: Parser crashes when using schema val with missing schema file
Type: Bug
Status: Closed
Resolution: WON'T FIX
Project: Xerces-C++
Components:
Validating Parser (Schema) (Xerces 1.5 or up only)
Versions:
1.7.0
Assignee:
Reporter: Joe Ceklosky
Created: Fri, 12 Apr 2002 12:08 PM
Updated: Tue, 19 Oct 2004 9:29 AM
Environment: Operating System: Solaris
Platform: Sun
Description:
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?
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org