You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2004/03/03 11:45:44 UTC

cvs commit: xml-xerces/c/src/xercesc/internal WFXMLScanner.cpp

amassari    2004/03/03 02:45:44

  Modified:    c/src/xercesc/internal WFXMLScanner.cpp
  Log:
  WFXMLScanner was throwing an index out of bound exception when an element with no attributes was found, because of a -1 assigned to an unsigned int variable
  
  Revision  Changes    Path
  1.21      +22 -20    xml-xerces/c/src/xercesc/internal/WFXMLScanner.cpp
  
  Index: WFXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/WFXMLScanner.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WFXMLScanner.cpp	11 Feb 2004 12:42:50 -0000	1.20
  +++ WFXMLScanner.cpp	3 Mar 2004 10:45:44 -0000	1.21
  @@ -1496,26 +1496,28 @@
           );
       }
   
  -    // 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
  -                ( 
  -                    XMLErrs::AttrAlreadyUsedInSTag
  -                        , curAtt->getName()
  -                        , elemDecl->getFullName()
  -                );
  +    if(attCount) {
  +        // 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
  +                    ( 
  +                        XMLErrs::AttrAlreadyUsedInSTag
  +                            , curAtt->getName()
  +                            , elemDecl->getFullName()
  +                    );
  +                }
               }
  -        }
  -    }  
  +        }  
  +    }
   
       // Resolve the qualified name to a URI.
       unsigned int uriId = resolvePrefix
  
  
  

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