⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287017 in webkit


Ignore:
Timestamp:
Dec 14, 2021, 1:35:38 AM (5 years ago)
Author:
youenn@apple.com
Message:

Null pointer crash in FetchResponse::clone
https://bugs.webkit.org/show_bug.cgi?id=234236
<rdar://86327601>

Reviewed by Alex Christensen.

From the log, we are most probably getting a null globalObject from a ScriptExecutionContext in FetchResponse::clone.
This may happen in case the document is navigated away but we still execute some code for it.
Add a null check to ensure we do not crash.

  • Modules/fetch/FetchResponse.cpp:

(WebCore::FetchResponse::clone):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r287015 r287017  
     12021-12-14  Youenn Fablet  <youenn@apple.com>
     2
     3        Null pointer crash in FetchResponse::clone
     4        https://bugs.webkit.org/show_bug.cgi?id=234236
     5        <rdar://86327601>
     6
     7        Reviewed by Alex Christensen.
     8
     9        From the log, we are most probably getting a null globalObject from a ScriptExecutionContext in FetchResponse::clone.
     10        This may happen in case the document is navigated away but we still execute some code for it.
     11        Add a null check to ensure we do not crash.
     12
     13        * Modules/fetch/FetchResponse.cpp:
     14        (WebCore::FetchResponse::clone):
     15
    1162021-12-14  Ben Nham  <nham@apple.com>
    217
  • trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp

    r286970 r287017  
    183183    // If loading, let's create a stream so that data is teed on both clones.
    184184    if (isLoading() && !m_readableStreamSource) {
    185         auto voidOrException = createReadableStream(*context.globalObject());
     185        auto* globalObject = context.globalObject();
     186        if (!globalObject)
     187            return Exception { InvalidStateError, "Context is stopped"_s };
     188
     189        auto voidOrException = createReadableStream(*globalObject);
    186190        if (UNLIKELY(voidOrException.hasException()))
    187191            return voidOrException.releaseException();
Note: See TracChangeset for help on using the changeset viewer.