<?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>174753</bug_id>
          
          <creation_ts>2017-07-22 02:18:13 -0700</creation_ts>
          <short_desc>[Mac WK2] Potential null deref in WKView if WebPageProxy callbacks are invalidated in -[WKView dealloc]</short_desc>
          <delta_ts>2017-08-05 15:21:33 -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>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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 name="Wenson Hsieh">wenson_hsieh</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1331329</commentid>
    <comment_count>0</comment_count>
    <who name="Wenson Hsieh">wenson_hsieh</who>
    <bug_when>2017-07-22 02:18:13 -0700</bug_when>
    <thetext>This code in WKView:

- (void)dealloc
{
    _data-&gt;_impl-&gt;page().setIconLoadingClient(nullptr);
    _data-&gt;_impl = nullptr;

    [_data release];
    _data = nil;

    [super dealloc];
}

...seems like it would be susceptible to the same problem described in https://bugs.webkit.org/show_bug.cgi?id=174751. If ~WebViewImpl is called after setting _data-&gt;_impl to nullptr and one of the pending callbacks that get invoked when invalidating the callback map calls on WKView to do some work involving the _data&apos;s _impl, we&apos;ll probably end up with a null deref.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335742</commentid>
    <comment_count>1</comment_count>
    <who name="Wenson Hsieh">wenson_hsieh</who>
    <bug_when>2017-08-05 15:21:33 -0700</bug_when>
    <thetext>Interestingly, this isn&apos;t normally an issue when closing the page because Safari actually tells the WebPageProxy to close() very early in the teardown process. That&apos;s not to say there shouldn&apos;t be a mechanism at the WebKit layer, though, to ensure that we don&apos;t crash if the WKView is released through some other codepath in Safari that doesn&apos;t explicitly close() the page before continuing with teardown.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>