<?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>141168</bug_id>
          
          <creation_ts>2015-02-02 12:35:34 -0800</creation_ts>
          <short_desc>Memory is written to after deallocated, in GraphicsLayer::setMaskLayer.</short_desc>
          <delta_ts>2015-02-02 13:39:13 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>peavo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alex.christensen</cc>
    
    <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>glenn</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1066191</commentid>
    <comment_count>0</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-02-02 12:35:34 -0800</bug_when>
    <thetext>Visual Studio detected that a deallocated heap block had been modified in GraphicsLayer::setMaskLayer, when called from RenderLayerBacking::updateChildClippingStrategy.

void GraphicsLayer::setMaskLayer(GraphicsLayer* layer)
{
    if (layer == m_maskLayer)
        return;

    if (layer) {
        layer-&gt;removeFromParent();
        layer-&gt;setParent(this);
        layer-&gt;setIsMaskLayer(true);
    } else if (m_maskLayer) {
        m_maskLayer-&gt;setParent(nullptr);    &lt;--------------- Writing to deallocated memory
        m_maskLayer-&gt;setIsMaskLayer(false); &lt;---------------
    }
    
    m_maskLayer = layer;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1066194</commentid>
    <comment_count>1</comment_count>
      <attachid>245894</attachid>
    <who name="">peavo</who>
    <bug_when>2015-02-02 12:40:43 -0800</bug_when>
    <thetext>Created attachment 245894
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1066200</commentid>
    <comment_count>2</comment_count>
      <attachid>245894</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2015-02-02 12:56:21 -0800</bug_when>
    <thetext>Comment on attachment 245894
Patch

Wow! That&apos;s not good! :-)

I guess this happens if the m_childClippingMaskLayer is also part of the layer hierarchy and is therefore accessed for a &quot;setMaskLayer&quot; update?

This might only happen in the WinCairo implementation due to its use of the texture mapping stuff to handle accelerated compositing.

r=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1066204</commentid>
    <comment_count>3</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-02-02 13:13:08 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 245894 [details]
&gt; Patch
&gt; 

Thanks for reviewing :)

&gt; Wow! That&apos;s not good! :-)
&gt; 
&gt; I guess this happens if the m_childClippingMaskLayer is also part of the
&gt; layer hierarchy and is therefore accessed for a &quot;setMaskLayer&quot; update?
&gt; 
&gt; This might only happen in the WinCairo implementation due to its use of the
&gt; texture mapping stuff to handle accelerated compositing.
&gt; 

Good point, could be a bug only on WinCairo.

Also, it was not really harmful, since the overwrite happened just after deallocation, and nobody had reallocated the block, yet ... :)

&gt; r=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1066208</commentid>
    <comment_count>4</comment_count>
      <attachid>245894</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-02-02 13:39:09 -0800</bug_when>
    <thetext>Comment on attachment 245894
Patch

Clearing flags on attachment: 245894

Committed r179495: &lt;http://trac.webkit.org/changeset/179495&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1066209</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-02-02 13:39:13 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>245894</attachid>
            <date>2015-02-02 12:40:43 -0800</date>
            <delta_ts>2015-02-02 13:39:09 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-141168-20150202214046.patch</filename>
            <type>text/plain</type>
            <size>1595</size>
            <attacher>peavo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3OTQ4NykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBACisyMDE1LTAyLTAyICBwZWF2b0Bv
dXRsb29rLmNvbSAgPHBlYXZvQG91dGxvb2suY29tPgorCisgICAgICAgIE1lbW9yeSBpcyB3cml0
dGVuIHRvIGFmdGVyIGRlYWxsb2NhdGVkLCBpbiBHcmFwaGljc0xheWVyOjpzZXRNYXNrTGF5ZXIu
CisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xNDExNjgK
KworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBWaXN1YWwg
U3R1ZGlvI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gaWYgKGhhc0NsaXBwaW5nTGF5ZXIoKSkK
ICAgICAgICAgICAgICAgICBjbGlwcGluZ0xheWVyKCktPnNldE1hc2tMYXllcihudWxscHRyKTsK
KyAgICAgICAgICAgIG1fY2hpbGRDbGlwcGluZ01hc2tMYXllciA9IG51bGxwdHI7CiAgICAgICAg
IH0gZWxzZSAKICAgICAgICAgICAgIGlmIChoYXNDbGlwcGluZ0xheWVyKCkpCiAgICAgICAgICAg
ICAgICAgY2xpcHBpbmdMYXllcigpLT5zZXRNYXNrc1RvQm91bmRzUmVjdChGbG9hdFJvdW5kZWRS
ZWN0KEZsb2F0UmVjdChGbG9hdFBvaW50KCksIGNsaXBwaW5nTGF5ZXIoKS0+c2l6ZSgpKSkpOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>