<?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>311020</bug_id>
          
          <creation_ts>2026-03-29 04:41:31 -0700</creation_ts>
          <short_desc>Crash due to nullptr deref in WebLocalFrameLoaderClient::dispatchDidChangeProvisionalURL()</short_desc>
          <delta_ts>2026-03-30 20:18:59 -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>Page Loading</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=199123</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=203837</see_also>
          <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="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>beidson</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2194853</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-03-29 04:41:31 -0700</bug_when>
    <thetext>`WebLocalFrameLoaderClient::dispatchDidChangeProvisionalURL()` unconditionally dereferences the return value of `provisionalDocumentLoader()` via `Ref documentLoader { *m_localFrame-&gt;loader().provisionalDocumentLoader() }`. When `provisionalDocumentLoader()` returns nullptr during redirect processing, the `Ref` constructor reads the reference count at offset 0x18, crashing with `EXC_BAD_ACCESS (SIGSEGV)`.

The caller `DocumentLoader::setRequest()` already checks for and logs this nullptr condition (added in Bug 203837, 217227@main) but proceeds to call `dispatchDidChangeProvisionalURL()` unconditionally.

The adjacent function `dispatchDidReceiveServerRedirectForProvisionalLoad()` correctly handles this case using `RefPtr` with a null check and early return (added in Bug 199123, 213141@main).

Crash stack:
```
0   WebKit:  WTF::RefCountedBase::ref() const
1   WebKit:  WebCore::DocumentLoader::ref() const
2   WebKit:  WTF::Ref&lt;WebCore::DocumentLoader&gt;::Ref(WebCore::DocumentLoader&amp;)
3   WebKit:  WebKit::WebLocalFrameLoaderClient::dispatchDidChangeProvisionalURL()
4   WebCore:  WebCore::DocumentLoader::setRequest(WebCore::ResourceRequest&amp;&amp;)
5   WebCore:  WebCore::DocumentLoader::willSendRequest(WebCore::ResourceRequest&amp;&amp;, ...)
6   WebCore:  WebCore::DocumentLoader::redirectReceived(...)
7   WebCore:  WebCore::CachedRawResource::redirectReceived(...)
8   WebCore:  WebCore::SubresourceLoader::willSendRequestInternal(...)
9   WebKit:  WebKit::WebResourceLoader::willSendRequest(...)
[...]
```

&lt;rdar://112727550&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2194882</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-03-29 08:15:44 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61625</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195405</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-30 20:18:57 -0700</bug_when>
    <thetext>Committed 310279@main (682966d153bc): &lt;https://commits.webkit.org/310279@main&gt;

Reviewed commits have been landed. Closing PR #61625 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>