[xml/sgml-commit] r356 - packages/xerces/xerces25/trunk/debian/patches
Jay Berkenbilt
ejb-guest@costa.debian.org
Wed, 16 Mar 2005 04:40:09 +0100
Author: ejb-guest
Date: 2005-03-16 04:40:09 +0100 (Wed, 16 Mar 2005)
New Revision: 356
Added:
packages/xerces/xerces25/trunk/debian/patches/CAN-2004-1575.patch
Log:
CAN-2004-1575.patch
Added: packages/xerces/xerces25/trunk/debian/patches/CAN-2004-1575.patch
===================================================================
--- packages/xerces/xerces25/trunk/debian/patches/CAN-2004-1575.patch 2005-03-16 03:39:45 UTC (rev 355)
+++ packages/xerces/xerces25/trunk/debian/patches/CAN-2004-1575.patch 2005-03-16 03:40:09 UTC (rev 356)
@@ -0,0 +1,282 @@
+--- xerces-c-src_2_5_0/src/xercesc/internal/XMLScanner.hpp.orig 2003-12-31 10:40:00.000000000 -0500
++++ xerces-c-src_2_5_0/src/xercesc/internal/XMLScanner.hpp 2005-03-15 20:39:50.553194368 -0500
+@@ -738,6 +738,13 @@
+ void resetUIntPool();
+ void recreateUIntPool();
+
++ inline
++ void setAttrDupChkRegistry
++ (
++ const unsigned int &attrNumber
++ , bool &toUseHashTable
++ );
++
+ // -----------------------------------------------------------------------
+ // Data members
+ //
+@@ -985,6 +992,7 @@
+ XMLUInt32 fScannerId;
+ XMLUInt32 fSequenceId;
+ RefVectorOf<XMLAttr>* fAttrList;
++ RefHash2KeysTableOf<XMLAttr>* fAttrDupChkRegistry;
+ XMLDocumentHandler* fDocHandler;
+ DocTypeHandler* fDocTypeHandler;
+ XMLEntityHandler* fEntityHandler;
+@@ -1490,6 +1498,29 @@
+ fEntityDeclPoolRetrieved = false;
+ }
+
++inline void XMLScanner::setAttrDupChkRegistry(const unsigned int &attrNumber
++ , bool &toUseHashTable)
++{
++ // once the attribute exceed 20, we use hash table to check duplication
++ if (attrNumber > 20)
++ {
++ toUseHashTable = true;
++
++ if (!fAttrDupChkRegistry)
++ {
++ fAttrDupChkRegistry = new (fMemoryManager) RefHash2KeysTableOf<XMLAttr>
++ (
++ 2*attrNumber+1, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
++ );
++ }
++ else
++ {
++ fAttrDupChkRegistry->removeAll();
++ }
++ }
++
++}
++
+ XERCES_CPP_NAMESPACE_END
+
+ #endif
+--- xerces-c-src_2_5_0/src/xercesc/internal/XMLScanner.cpp.orig 2004-01-29 06:46:30.000000000 -0500
++++ xerces-c-src_2_5_0/src/xercesc/internal/XMLScanner.cpp 2005-03-15 20:39:50.540196344 -0500
+@@ -194,6 +194,7 @@
+ , fScannerId(0)
+ , fSequenceId(0)
+ , fAttrList(0)
++ , fAttrDupChkRegistry(0)
+ , fDocHandler(0)
+ , fDocTypeHandler(0)
+ , fEntityHandler(0)
+@@ -271,6 +272,7 @@
+ , fScannerId(0)
+ , fSequenceId(0)
+ , fAttrList(0)
++ , fAttrDupChkRegistry(0)
+ , fDocHandler(docHandler)
+ , fDocTypeHandler(docTypeHandler)
+ , fEntityHandler(entityHandler)
+@@ -313,6 +315,7 @@
+ XMLScanner::~XMLScanner()
+ {
+ delete fAttrList;
++ delete fAttrDupChkRegistry;
+ delete fValidationContext;
+ fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName;
+ fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation;
+--- xerces-c-src_2_5_0/src/xercesc/internal/WFXMLScanner.cpp.orig 2005-03-15 20:39:50.532197560 -0500
++++ xerces-c-src_2_5_0/src/xercesc/internal/WFXMLScanner.cpp 2005-03-15 21:31:48.348217480 -0500
+@@ -1496,26 +1496,53 @@
+ );
+ }
+
+- // check for duplicate namespace attributes:
+- // by checking for qualified names with the same local part and with prefixes
+- // which have been bound to namespace names that are identical.
+- XMLAttr* loopAttr;
+- XMLAttr* curAtt;
+- for (unsigned int attrIndex=0; attrIndex < attCount-1; attrIndex++) {
+- loopAttr = fAttrList->elementAt(attrIndex);
+- for (unsigned int curAttrIndex = attrIndex+1; curAttrIndex < attCount; curAttrIndex++) {
+- curAtt = fAttrList->elementAt(curAttrIndex);
+- if (curAtt->getURIId() == loopAttr->getURIId() &&
+- XMLString::equals(curAtt->getName(), loopAttr->getName())) {
+- emitError
+- (
++ if (attCount) {
++
++ //
++ // Decide if to use hash table to do duplicate checking
++ //
++ bool toUseHashTable = false;
++ setAttrDupChkRegistry(attCount, toUseHashTable);
++
++ // check for duplicate namespace attributes:
++ // by checking for qualified names with the same local part and with prefixes
++ // which have been bound to namespace names that are identical.
++ XMLAttr* loopAttr;
++ XMLAttr* curAtt;
++ for (unsigned int attrIndex=0; attrIndex < attCount-1; attrIndex++) {
++ loopAttr = fAttrList->elementAt(attrIndex);
++
++ if (!toUseHashTable)
++ {
++ for (unsigned int curAttrIndex = attrIndex+1; curAttrIndex < attCount; curAttrIndex++) {
++ curAtt = fAttrList->elementAt(curAttrIndex);
++ if (curAtt->getURIId() == loopAttr->getURIId() &&
++ XMLString::equals(curAtt->getName(), loopAttr->getName())) {
++ emitError
++ (
++ XMLErrs::AttrAlreadyUsedInSTag
++ , curAtt->getName()
++ , elemDecl->getFullName()
++ );
++ }
++ }
++ }
++ else
++ {
++ if (fAttrDupChkRegistry->containsKey((void*)loopAttr->getName(), loopAttr->getURIId()))
++ {
++ emitError
++ (
+ XMLErrs::AttrAlreadyUsedInSTag
+- , curAtt->getName()
+- , elemDecl->getFullName()
+- );
++ , loopAttr->getName()
++ , elemDecl->getFullName()
++ );
++ }
++
++ fAttrDupChkRegistry->put((void*)loopAttr->getName(), loopAttr->getURIId(), loopAttr);
+ }
+- }
+- }
++ }
++ }
+
+ // Resolve the qualified name to a URI.
+ unsigned int uriId = resolvePrefix
+--- xerces-c-src_2_5_0/src/xercesc/internal/DGXMLScanner.cpp.orig 2004-02-03 11:43:14.000000000 -0500
++++ xerces-c-src_2_5_0/src/xercesc/internal/DGXMLScanner.cpp 2005-03-15 20:39:50.547195280 -0500
+@@ -2387,6 +2387,13 @@
+ void DGXMLScanner::scanAttrListforNameSpaces(RefVectorOf<XMLAttr>* theAttrList, int attCount,
+ XMLElementDecl* elemDecl)
+ {
++
++ //
++ // Decide if to use hash table to do duplicate checking
++ //
++ bool toUseHashTable = false;
++ setAttrDupChkRegistry((unsigned int&)attCount, toUseHashTable);
++
+ // Make an initial pass through the list and find any xmlns attributes or
+ // schema attributes.
+ // When we find one, send it off to be used to update the element stack's
+@@ -2421,17 +2428,35 @@
+ // by checking for qualified names with the same local part and with prefixes
+ // which have been bound to namespace names that are identical.
+ XMLAttr* loopAttr;
+- for (int attrIndex=0; attrIndex < index; attrIndex++) {
+- loopAttr = theAttrList->elementAt(attrIndex);
+- if (loopAttr->getURIId() == curAttr->getURIId() &&
+- XMLString::equals(loopAttr->getName(), curAttr->getName())) {
++
++ if (!toUseHashTable)
++ {
++ for (int attrIndex=0; attrIndex < index; attrIndex++) {
++ loopAttr = theAttrList->elementAt(attrIndex);
++ if (loopAttr->getURIId() == curAttr->getURIId() &&
++ XMLString::equals(loopAttr->getName(), curAttr->getName())) {
++ emitError
++ (
++ XMLErrs::AttrAlreadyUsedInSTag
++ , curAttr->getName()
++ , elemDecl->getFullName()
++ );
++ }
++ }
++ }
++ else
++ {
++ if (fAttrDupChkRegistry->containsKey((void*)curAttr->getName(), curAttr->getURIId()))
++ {
+ emitError
+- (
++ (
+ XMLErrs::AttrAlreadyUsedInSTag
+ , curAttr->getName()
+ , elemDecl->getFullName()
+- );
++ );
+ }
++
++ fAttrDupChkRegistry->put((void*)curAttr->getName(), curAttr->getURIId(), curAttr);
+ }
+ }
+ }
+--- xerces-c-src_2_5_0/src/xercesc/internal/IGXMLScanner2.cpp.orig 2004-01-29 06:46:30.000000000 -0500
++++ xerces-c-src_2_5_0/src/xercesc/internal/IGXMLScanner2.cpp 2005-03-15 20:39:50.561193152 -0500
+@@ -151,6 +151,15 @@
+ XMLBufBid bbNormal(&fBufMgr);
+ XMLBuffer& normBuf = bbNormal.getBuffer();
+
++ //
++ // Decide if to use hash table to do duplicate checking
++ //
++ bool toUseHashTable = false;
++ if (fGrammarType == Grammar::DTDGrammarType)
++ {
++ setAttrDupChkRegistry(attCount, toUseHashTable);
++ }
++
+ // Loop through our explicitly provided attributes, which are in the raw
+ // scanned form, and build up XMLAttr objects.
+ unsigned int index;
+@@ -687,16 +696,32 @@
+ // by checking for qualified names with the same local part and with prefixes
+ // which have been bound to namespace names that are identical.
+ if (fGrammarType == Grammar::DTDGrammarType) {
+- for (unsigned int attrIndex=0; attrIndex < retCount; attrIndex++) {
+- curAttr = toFill.elementAt(attrIndex);
+- if (uriId == curAttr->getURIId() &&
+- XMLString::equals(suffPtr, curAttr->getName())) {
++ if (!toUseHashTable)
++ {
++ for (unsigned int attrIndex=0; attrIndex < retCount; attrIndex++) {
++ curAttr = toFill.elementAt(attrIndex);
++ if (uriId == curAttr->getURIId() &&
++ XMLString::equals(suffPtr, curAttr->getName())) {
++ emitError
++ (
++
++ XMLErrs::AttrAlreadyUsedInSTag
++ , curAttr->getName()
++ , elemDecl->getFullName()
++ );
++ }
++ }
++ }
++ else
++ {
++ if (fAttrDupChkRegistry->containsKey((void*)suffPtr, uriId))
++ {
+ emitError
+- (
++ (
+ XMLErrs::AttrAlreadyUsedInSTag
+ , curAttr->getName()
+ , elemDecl->getFullName()
+- );
++ );
+ }
+ }
+ }
+@@ -732,6 +757,12 @@
+ );
+ curAttr->setSpecified(true);
+ }
++
++ if (toUseHashTable)
++ {
++ fAttrDupChkRegistry->put((void*)suffPtr, uriId, curAttr);
++ }
++
+ if(psviAttr)
+ psviAttr->setValue(curAttr->getValue());
+