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 "Boris Kolpackov (JIRA)" <xe...@xml.apache.org> on 2009/11/18 11:55:39 UTC

[jira] Closed: (XERCESC-1826) XMLURL::makeNewStream() fails to decode file:/// URLs containing the (properly escaped) % character

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

Boris Kolpackov closed XERCESC-1826.
------------------------------------

    Resolution: Fixed

The fix is in SVN.

> XMLURL::makeNewStream() fails to decode file:/// URLs containing the (properly escaped) % character
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1826
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1826
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5.0, 2.6.0, 2.7.0, 2.8.0, 3.0.0, 2.9.0, 3.1.0
>         Environment: Windows XP Prof. German, MS Visual Studio 2003
>            Reporter: Matteo Ceruti
>            Assignee: Boris Kolpackov
>             Fix For: 3.1.0
>
>
> I truly believe that XMLURL::makeNewStream() (see src/xercesc/util/XMLURL.cpp) does not correctly handle file:///-URLs containing the escape-sequence %25 (that is the '%'-character itself). Consider you have a win32 filepath like "C:\Documents\myfile_%_.xml" . Its URL would be "file:///C:/Documents/myfile_%25_.xml", right? But this URL is rejected by raising a MalformedURLException.
> makeNewStream() decodes the URL by searching and replacing the escape-sequences one by one. When it sucessfully replaced %25 by the '%'-character it continunes it's search for the next escape-sequence. The problem is, that it starts at the very position, where the last escape-sequence began. Therefore it suddenly finds a %-character again, because it had just been put there.
> This happens at least with xerces-c 2.5 and it seems that the current (revision=670359) http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLURL.cpp still has this problem. So probably other releases may have the same issue.
> I think the line
>  percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex, fMemoryManager);
> should be replaced by 
>  percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex + 1, fMemoryManager);
> This works for me.
> Please correct me, if I'm wrong. Thank you in advance.
> Best regards,
>  Matteo

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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