<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>33971</bug_id>
          
          <creation_ts>2010-01-21 13:55:55 -0800</creation_ts>
          <short_desc>Check base URI validity before using in SVGImageLoader::sourceURI</short_desc>
          <delta_ts>2011-03-07 12:48:42 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>55750</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Bryan Yeung">bryeung</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ctruta</cc>
    
    <cc>fsamuel</cc>
    
    <cc>krit</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>183307</commentid>
    <comment_count>0</comment_count>
    <who name="Bryan Yeung">bryeung</who>
    <bug_when>2010-01-21 13:55:55 -0800</bug_when>
    <thetext>If the element has no baseURI, then the sourceURI method will use an invalidated KURL object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>183308</commentid>
    <comment_count>1</comment_count>
      <attachid>47145</attachid>
    <who name="Bryan Yeung">bryeung</who>
    <bug_when>2010-01-21 14:00:19 -0800</bug_when>
    <thetext>Created attachment 47145
patch checks for URL validity before using</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>183316</commentid>
    <comment_count>2</comment_count>
      <attachid>47145</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-21 14:22:17 -0800</bug_when>
    <thetext>Comment on attachment 47145
patch checks for URL validity before using

The call to deprecatedParseURL needs to be on the attr value *before* invoking KURL at all. Making that change alone might fix the bug. Something like this:

    return KURL(element()-&gt;baseURI(), deprecatedParseURL(attr));

This bug needs a test case. review- for lack of a test case and because the fix is probably wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>183724</commentid>
    <comment_count>3</comment_count>
    <who name="Bryan Yeung">bryeung</who>
    <bug_when>2010-01-22 11:35:58 -0800</bug_when>
    <thetext>Darin:

Thanks for taking the time to look at my patch, and sorry: I should have included a bit more context around this issue.

I don&apos;t think that the code you suggest addresses the problem that I see: element()-&gt;baseURI() is an invalidated KURL object whenever the SVG element does not have an xml:base specified.  The code works anyway, because the relative path is still available from the invalidated URL, but it seems dangerous/wrong to make use of invalidated objects.  (I&apos;ve created a separate bug to track this behaviour of KURL: https://bugs.webkit.org/show_bug.cgi?id=34011).  Maybe I&apos;m just misunderstanding what it means for a KURL to be invalidated?

Further, all of the other subclasses of ImageLoader return the result of deprecatedParseURL.  If you&apos;re suggesting that this is incorrect, it will presumably need to be fixed everywhere (and has been wrong for quite some time...since rev 36712 which introduced the sourceURI method).

I completely agree about the test case: I&apos;ll update the patch in a bit to include a new layout test that has images with and without a base URI specified.

Thanks again,

Bryan</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>183735</commentid>
    <comment_count>4</comment_count>
    <who name="Bryan Yeung">bryeung</who>
    <bug_when>2010-01-22 12:00:33 -0800</bug_when>
    <thetext>Actually, it looks like the test case I was about to write already exists:
LayoutTests/svg/W3C-SVG-1.1/struct-image-07-t.svg

This tests image elements with and without an xml:base specified, and exercises both paths in my proposed change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>342812</commentid>
    <comment_count>5</comment_count>
    <who name="Cosmin Truta">ctruta</who>
    <bug_when>2011-01-31 14:23:10 -0800</bug_when>
    <thetext>The following comment currently exists in KURLGoogle.cpp:

    // When KURL encounters an error such that the URL is invalid and empty
    // (for example, resolving a relative URL on a non-hierarchical base), it
    // will produce an isNull URL, and calling setUtf8 will produce an empty
    // non-null URL. This is unlikely to affect anything, but we preserve this
    // just in case.

It looks like this bug is caused by this behavior.

More specifically, here is what&apos;s happening if base=&quot;&quot; and relative=&quot;foo.svg&quot;:

* KURLGooglePrivate::init assumes (incorrectly?) that url_util::ResolveRelative always sets &amp;output, regardless whether it returns VALID or INVALID.
* url_util::ResolveRelative only sets &amp;output if url_canon::IsRelativeURL returns TRUE.
* url_canon::IsRelativeURL returns FALSE:
  - IsRelativeURL does not allow relative URLs if the base scheme does not support it.
  - base=&quot;&quot;, therefore it has no scheme.

While I agree that a URL composed from base=&quot;&quot; and relative=&quot;foo.svg&quot; is invalid, I think that the behavior of KURL to set output=&quot;foo.svg&quot; is useful (in contrast with the behavior of KURLGooglePrivate to set output=&quot;&quot;).

In order to resolve this bug, KURLGooglePrivate must agree with KURL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343797</commentid>
    <comment_count>6</comment_count>
    <who name="Cosmin Truta">ctruta</who>
    <bug_when>2011-02-01 20:18:26 -0800</bug_when>
    <thetext>The failing test that I mentioned in comment #5 is listed in the Chromium issue 42465
http://code.google.com/p/chromium/issues/detail?id=42465</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>363506</commentid>
    <comment_count>7</comment_count>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-03-07 12:48:42 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 55750 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>47145</attachid>
            <date>2010-01-21 14:00:19 -0800</date>
            <delta_ts>2010-06-10 20:38:47 -0700</delta_ts>
            <desc>patch checks for URL validity before using</desc>
            <filename>patch.txt</filename>
            <type>text/plain</type>
            <size>1075</size>
            <attacher name="Bryan Yeung">bryeung</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
MWY1NTlhOS4uMmM0MTBhOCAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNCBAQAorMjAxMC0wMS0yMSAgQnJ5YW4gWWV1bmcg
IDxicnlldW5nQGNocm9taXVtLm9yZz4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9P
UFMhKS4KKworICAgICAgICBVcGRhdGUgc291cmNlVVJJIHRvIGNoZWNrIGZvciBpbnZhbGlkIGJh
c2VVUklzLgorCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9p
ZD0zMzk3MQorCisgICAgICAgICogc3ZnL1NWR0ltYWdlTG9hZGVyLmNwcDoKKyAgICAgICAgKFdl
YkNvcmU6OlNWR0ltYWdlTG9hZGVyOjpzb3VyY2VVUkkpOgorCiAyMDEwLTAxLTIxICBBbmRyZWkg
UG9wZXNjdSAgPGFuZHJlaXBAZ29vZ2xlLmNvbT4KIAogICAgICAgICBSZXZpZXdlZCBieSBEYXZp
ZCBMZXZpbi4KZGlmZiAtLWdpdCBhL1dlYkNvcmUvc3ZnL1NWR0ltYWdlTG9hZGVyLmNwcCBiL1dl
YkNvcmUvc3ZnL1NWR0ltYWdlTG9hZGVyLmNwcAppbmRleCA1ZDVkM2JjLi4yNzRlNjVkIDEwMDY0
NAotLS0gYS9XZWJDb3JlL3N2Zy9TVkdJbWFnZUxvYWRlci5jcHAKKysrIGIvV2ViQ29yZS9zdmcv
U1ZHSW1hZ2VMb2FkZXIuY3BwCkBAIC01NCw3ICs1NCwxMCBAQCB2b2lkIFNWR0ltYWdlTG9hZGVy
OjpkaXNwYXRjaExvYWRFdmVudCgpCiAKIFN0cmluZyBTVkdJbWFnZUxvYWRlcjo6c291cmNlVVJJ
KGNvbnN0IEF0b21pY1N0cmluZyYgYXR0cikgY29uc3QKIHsKLSAgICByZXR1cm4gZGVwcmVjYXRl
ZFBhcnNlVVJMKEtVUkwoZWxlbWVudCgpLT5iYXNlVVJJKCksIGF0dHIpLnN0cmluZygpKTsKKyAg
ICBLVVJMIGJhc2UoZWxlbWVudCgpLT5iYXNlVVJJKCkpOworICAgIGlmICghYmFzZS5pc1ZhbGlk
KCkpIHJldHVybiBkZXByZWNhdGVkUGFyc2VVUkwoYXR0cik7CisKKyAgICByZXR1cm4gZGVwcmVj
YXRlZFBhcnNlVVJMKEtVUkwoYmFzZSwgYXR0cikuc3RyaW5nKCkpOwogfQogCiB9Cg==
</data>
<flag name="review"
          id="29543"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>