[jira] [Created] (BATIK-1247) Parsing short relative hyper refrences in jar packed svg files causes java.lang.IndexOutOfBoundsException

Mario Förster (JIRA) <[email protected]> Fri, 21 Dec 2018 13:09:00 +0000 (UTC)
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
Mario Förster created BATIK-1247:
------------------------------------

             Summary: Parsing short relative hyper refrences in jar packed svg files causes java.lang.IndexOutOfBoundsException
                 Key: BATIK-1247
                 URL: https://issues.apache.org/jira/browse/BATIK-1247
             Project: Batik
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 1.10
            Reporter: Mario Förster


If there is a short relative hyper refrence less four chars length in total within a svg file which is packed into a jar file. Loading it will cause an java.lang.IndexOutOfBoundsException to be thrown.

example file:

 
{code:java|bgColor=#efefef}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="320" height="320" viewBox="0 0 320 320" stroke-linecap="round" stroke="#000">
  <defs>
    <path id="r" d="m160,160l0,0 0,0">
    </path>
  </defs>
  <use xlink:href="#r"/>
</svg>
{code}
 

 

Point of failure:

org.apache.batik.util.ParsedURLJarProtocolHandler - parseURL Method

{code:java}
String start = urlStr.substring(0, JAR.length()+1).toLowerCase();
{code}
 

Problem should be solved by adding an additional check within org.apache.batik.util.ParsedURLJarProtocolHandler 's parseURL method or by using {color:#f79232}startsWith{color} string method ...

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)