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 "Scott Cantor (JIRA)" <xe...@xml.apache.org> on 2015/02/28 03:28:04 UTC

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

     [ https://issues.apache.org/jira/browse/XERCESC-1978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor closed XERCESC-1978.
---------------------------------

Applied to 3.1 branch, r1662888

This is a modified fix that is ABI safe. The original patch modified only an internal struct that isn't supposed to be public, but to eliminate any possibility of a change, this is a less efficient fix that manually checks string lengths instead of storing them in-struct.

> 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
>            Assignee: Alberto Massari
>            Priority: Blocker
>             Fix For: 3.1.2, 3.2.0
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

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