Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1978

DOMDocumentImpl:: getPooledNString(const XMLCh *in, XMLSize_t n) returns incorrect string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.1.1
    • 3.1.2, 3.2.0
    • DOM
    • None
    • Windows x32, but should be everywhere

    Description

      the methods returns the original string rather than the substring if the substring and original string have the same hash code.
      This leeds to corrupt xml files due to prefixes being replaced by the entire string:
      Original version:
      while (*pspe != 0)
      {
      if (XMLString::equals((*pspe)->fString, in))
      return (*pspe)->fString;
      ...

      Bugfix suggestion:
      //RP 120416 we need to check for length of the returned <=n; else any hash matching string longer than n will be accepted — bad snafu!
      if (XMLString::equalsN((*pspe)>fString, in, n) && XMLString::stringLen( (*pspe)>fString)<=n)

      Example prefix + attribute name that will fail:
      HDM:
      HDM:OffsetBack

      Attachments

        Issue Links

          Activity

            People

              amassari Alberto Massari
              prosi Rainer Prosi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: