<?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>78700</bug_id>
          
          <creation_ts>2012-02-15 05:23:42 -0800</creation_ts>
          <short_desc>SVG TRef/Use NULL ptr</short_desc>
          <delta_ts>2012-05-16 00:43:35 -0700</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>PC</rep_platform>
          <op_sys>Windows Vista</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Berend-Jan Wever">skylined</reporter>
          <assigned_to name="Nikolas Zimmermann">zimmermann</assigned_to>
          <cc>abarth</cc>
    
    <cc>cc-bugs</cc>
    
    <cc>cgarcia</cc>
    
    <cc>eric</cc>
    
    <cc>fmalita</cc>
    
    <cc>gustavo</cc>
    
    <cc>jamesr</cc>
    
    <cc>japhet</cc>
    
    <cc>levin+threading</cc>
    
    <cc>macpherson</cc>
    
    <cc>menard</cc>
    
    <cc>ojan</cc>
    
    <cc>rakuco</cc>
    
    <cc>rwlbuis</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>zimmermann</cc>
    
    <cc>zoltan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>557179</commentid>
    <comment_count>0</comment_count>
    <who name="Berend-Jan Wever">skylined</who>
    <bug_when>2012-02-15 05:23:42 -0800</bug_when>
    <thetext>http://code.google.com/p/chromium/issues/detail?id=114358
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
  &lt;g id=&quot;g&quot;&gt;
    &lt;animate id=&quot;animate&quot;&gt;
    &lt;/animate&gt;
    &lt;tref xlink:href=&quot;#animate&quot;&gt;
    &lt;/tref&gt;
  &lt;/g&gt;
  &lt;use xlink:href=&quot;#g&quot;&gt;
  &lt;/use&gt;
&lt;/svg&gt;

src\third_party\webkit\source\webcore\svg\svgtrefelement.cpp
void SVGTRefElement::buildPendingResource()
{
&lt;&lt;&lt;snip&gt;&gt;&gt;
    m_eventListener = SubtreeModificationEventListener::create(this, id);
    ASSERT(target-&gt;parentNode());
    target-&gt;parentNode()-&gt;addEventListener(eventNames().DOMSubtreeModifiedEvent, m_eventListener.get(), false);
}

src\third_party\webkit\source\webcore\dom\node.cpp
bool Node::addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt; listener, bool useCapture)
{
&lt;&lt;&lt;snip&gt;&gt;&gt;
    for (HashSet&lt;SVGElementInstance*&gt;::const_iterator it = instances.begin(); it != end; ++it) {
        ASSERT((*it)-&gt;shadowTreeElement());
        ASSERT((*it)-&gt;correspondingElement() == this);

        RefPtr&lt;EventListener&gt; listenerForCurrentShadowTreeElement = listenerForShadowTree;
        bool result = tryAddEventListener((*it)-&gt;shadowTreeElement(), eventType, listenerForCurrentShadowTreeElement.release(), useCapture);
&lt;&lt;&lt;snip&gt;&gt;&gt;

(*it) points to an SVGUseElement which doesn&apos;t have a shadowTreeElement, causing the NULL ptr.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>557184</commentid>
    <comment_count>1</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-02-15 05:31:36 -0800</bug_when>
    <thetext>(In reply to comment #0)
&gt; &lt;&lt;&lt;snip&gt;&gt;&gt;
&gt;     m_eventListener = SubtreeModificationEventListener::create(this, id);
&gt;     ASSERT(target-&gt;parentNode());
&gt;     target-&gt;parentNode()-&gt;addEventListener(eventNames().DOMSubtreeModifiedEvent, m_eventListener.get(), false);

&gt; (*it) points to an SVGUseElement which doesn&apos;t have a shadowTreeElement, causing the NULL ptr.
Oh dear, apparently &lt;tref&gt; doesn&apos;t even check if the target is valid, just attaching its event listener. This is a bad idea. CC&apos;ing Rob, who wrote the current &lt;tref&gt; implementation.

Reminds me of a similar &lt;use&gt; bug which is in the process of being fixed: white-list allowed targets, instead of black-listing disallowed ones.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>557509</commentid>
    <comment_count>2</comment_count>
    <who name="Florin Malita">fmalita</who>
    <bug_when>2012-02-15 13:33:53 -0800</bug_when>
    <thetext>FWIW my patch for http://www.webkit.org/b/74858 also fixes this particular crash (as the event listeners are moved onto the target instead of its parent). Sounds like we still need to add target validation though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>557629</commentid>
    <comment_count>3</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-02-15 15:22:16 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; FWIW my patch for http://www.webkit.org/b/74858 also fixes this particular crash (as the event listeners are moved onto the target instead of its parent). Sounds like we still need to add target validation though.

Just looked at this again, Rob did it just correct according to SVG 1.1 2nd edition: &quot;xlink:href of &lt;tref&gt;: An IRI reference to an element whose character data content shall be used as character data for this ‘tref’ element.&quot; There&apos;s no white or black-listing desired, any element should work.

So probably this is just a dup of your bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>568612</commentid>
    <comment_count>4</comment_count>
      <attachid>129693</attachid>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-03-01 06:11:30 -0800</bug_when>
    <thetext>Created attachment 129693
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>568614</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-03-01 06:14:14 -0800</bug_when>
    <thetext>Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>568615</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-03-01 06:15:27 -0800</bug_when>
    <thetext>Attachment 129693 did not pass style-queue:

Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;ChangeLog&apos;, u&apos;LayoutTests/ChangeLog&apos;, u&apos;La...&quot; exit_code: 1
WARNING: File exempt from style guide. Skipping: &quot;Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h&quot;
Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:71:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 1 in 176 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>568623</commentid>
    <comment_count>7</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-03-01 06:26:27 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; If any of these errors are false positives, please file a bug against check-webkit-style.
Not mine. Bug was already filed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>579195</commentid>
    <comment_count>8</comment_count>
      <attachid>129693</attachid>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2012-03-15 01:26:36 -0700</bug_when>
    <thetext>Comment on attachment 129693
Patch

Adding test doesn&apos;t hurt. Could you update the ChangeLog to put diff to the head?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>625091</commentid>
    <comment_count>9</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-05-16 00:43:35 -0700</bug_when>
    <thetext>Committed r117229: &lt;http://trac.webkit.org/changeset/117229&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>129693</attachid>
            <date>2012-03-01 06:11:30 -0800</date>
            <delta_ts>2012-03-15 01:26:36 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-78700-20120301151128.patch</filename>
            <type>text/plain</type>
            <size>1776</size>
            <attacher name="Nikolas Zimmermann">zimmermann</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTA5MzQyCmRpZmYgLS1naXQgYS9MYXlvdXRUZXN0cy9DaGFu
Z2VMb2cgYi9MYXlvdXRUZXN0cy9DaGFuZ2VMb2cKaW5kZXggNjUzNjMzYWJmZTZlNmM5YTQyY2Zk
MDc1Y2Q0NWY2YzdjMWNlNmJiZC4uYjA1YTlhOWU3MTM4ODYwNzU4OTg5N2Y1MThhZjkzMjg5YjYw
M2MyMiAxMDA2NDQKLS0tIGEvTGF5b3V0VGVzdHMvQ2hhbmdlTG9nCisrKyBiL0xheW91dFRlc3Rz
L0NoYW5nZUxvZwpAQCAtMSw1ICsxLDE1IEBACiAyMDEyLTAzLTAxICBOaWtvbGFzIFppbW1lcm1h
bm4gIDxuemltbWVybWFubkByaW0uY29tPgogCisgICAgICAgIFNWRyBUUmVmL1VzZSBOVUxMIHB0
cgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9Nzg3MDAK
KworICAgICAgICBBZGQgdGVzdGNhc2UgY292ZXJpbmcgYSBwcm9ibGVtIGZpeGVkIGluIHRydW5r
LgorCisgICAgICAgICogc3ZnL2N1c3RvbS9idWc3ODcwMC1leHBlY3RlZC50eHQ6IEFkZGVkLgor
ICAgICAgICAqIHN2Zy9jdXN0b20vYnVnNzg3MDAuc3ZnOiBBZGRlZC4KKworMjAxMi0wMy0wMSAg
Tmlrb2xhcyBaaW1tZXJtYW5uICA8bnppbW1lcm1hbm5AcmltLmNvbT4KKwogICAgICAgICBJbnRy
b2R1Y2U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sbnM6eGxpbms9Imh0dHA6Ly93
d3cudzMub3JnLzE5OTkveGxpbmsiPgorICA8ZGVmcz48dGV4dD5UaGlzIHRlc3QgcGFzc2VzIGlm
IHRoZXJlIGlzIG5vIGNyYXNoPC90ZXh0PjwvZGVmcz4KKyAgPHNjcmlwdD4KKyAgICBpZiAod2lu
ZG93LmxheW91dFRlc3RDb250cm9sbGVyKQorICAgICAgbGF5b3V0VGVzdENvbnRyb2xsZXIuZHVt
cEFzVGV4dCgpOworICA8L3NjcmlwdD4KKyAgPGcgaWQ9ImciPgorICAgIDxhbmltYXRlIGlkPSJh
bmltYXRlIj4KKyAgICA8L2FuaW1hdGU+CisgICAgPHRyZWYgeGxpbms6aHJlZj0iI2FuaW1hdGUi
PgorICAgIDwvdHJlZj4KKyAgPC9nPgorICA8dXNlIHhsaW5rOmhyZWY9IiNnIj4KKyAgPC91c2U+
Cis8L3N2Zz4K
</data>
<flag name="review"
          id="132435"
          type_id="1"
          status="+"
          setter="morrita"
    />
    <flag name="commit-queue"
          id="132436"
          type_id="3"
          status="-"
          setter="morrita"
    />
          </attachment>
      

    </bug>

</bugzilla>