« Return to Thread: [jira] [Created] (XERCESC-1978) DOMDocumentImpl:: getPooledNString(const XMLCh *in, XMLSize_t n) returns incorrect string

[jira] [Created] (XERCESC-1978) DOMDocumentImpl:: getPooledNString(const XMLCh *in, XMLSize_t n) returns incorrect string

by JIRA xerces-c-dev@xml.apache.org :: Rate this Message:

| View in Thread

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

                 Key: XERCESC-1978
                 URL: https://issues.apache.org/jira/browse/XERCESC-1978
             Project: Xerces-C++
          Issue Type: Bug
          Components: DOM
    Affects Versions: 3.1.1
         Environment: Windows x32, but should be everywhere
            Reporter: Rainer Prosi
            Priority: Blocker


the methods returns the original string rather than the substring(n) 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



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@...
For additional commands, e-mail: c-dev-help@...

 « Return to Thread: [jira] [Created] (XERCESC-1978) DOMDocumentImpl:: getPooledNString(const XMLCh *in, XMLSize_t n) returns incorrect string