<?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>17956</bug_id>
          
          <creation_ts>2008-03-19 14:14:27 -0700</creation_ts>
          <short_desc>possible write to freed memory in EventTargetNode::dispatchSimulatedMouseEvent()</short_desc>
          <delta_ts>2009-08-12 16:49:42 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Roman">eroman</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>adele</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>koivisto</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>74468</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Roman">eroman</who>
    <bug_when>2008-03-19 14:14:27 -0700</bug_when>
    <thetext>Not certain about this, but it looks like if the event handler deletes the node within dispatchSimulatedMouseEvent(), there can be a subsequent assignment to freed memory:

EventTargetNode::dispatchSimulatedMouseEvent(...) {
    ...

    m_dispatchingSimulatedEvent = true;

   
    // &lt;--- The event handler may end up deleting &quot;this&quot; ---&gt;
    dispatchMouseEvent(...);
   
    // &lt;--- Could this assignment happen to freed memory? ---&gt;
    m_dispatchingSimulatedEvent = false;
}

I ran into a problem when using an access key that deleted the anchor (LayoutTests/fast/events/access-key-self-destruct.html) -- however I am not certain if there were other modifications in my code that could have caused this problem.

Can someone familiar with the method comment if this is a problem?

(I see that EventTargetNode::dispatchMouseEvent() protects &quot;this&quot; from deletion, why does this block not require it too?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74469</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2008-03-19 14:19:58 -0700</bug_when>
    <thetext>It should be possible to construct a test case which crashes due to this issue.  It may require GuardMalloc to be enabled to reproducibly crash though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74470</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2008-03-19 14:20:10 -0700</bug_when>
    <thetext>&lt;rdar://problem/5808517&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76097</commentid>
    <comment_count>3</comment_count>
    <who name="Adele Peterson">adele</who>
    <bug_when>2008-04-01 17:44:08 -0700</bug_when>
    <thetext>I&apos;ve been trying to create a test case where the node gets destroyed that early, and I&apos;ve been unsuccessful.  I think its because the Event keeps a RefPtr to the EventTarget...and dispatchSimulatedClick has a RefPtr for the event, so the event and the target node can&apos;t get destroyed until after dispatchSimulatedClick exits.  Someone should check my logic on that though...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80648</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-05-16 13:50:33 -0700</bug_when>
    <thetext>The m_dispatchingSimulatedMouseEvent bool is gone from TOT.  This bug can be closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139652</commentid>
    <comment_count>5</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2009-08-12 16:49:42 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; The m_dispatchingSimulatedMouseEvent bool is gone from TOT.  This bug can be
&gt; closed.

The m_dispatchingSimulatedEvent bool was removed in r31767.

&lt;http://trac.webkit.org/changeset/31767&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>