[tbb-commits] [tor-browser] 76/76: Bug 1761026 - Add a null check for FetchDriver::mResponse, r=necko-reviewers, dragana a=dmeehan

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:44 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit a981804052f46924027b7d91896844ca5df9aafc
Author: Kershaw Chang <kershaw at mozilla.com>
AuthorDate: Wed Mar 30 13:13:01 2022 +0000

    Bug 1761026 - Add a null check for FetchDriver::mResponse, r=necko-reviewers,dragana a=dmeehan
    
    This patch adds a null check to avoid crashing when `mResponse` is null.
    
    Differential Revision: https://phabricator.services.mozilla.com/D141911
---
 dom/fetch/FetchDriver.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp
index 8eac7c1e688eb..4da3e0faa2f0b 100644
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -1295,10 +1295,14 @@ FetchDriver::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInputStream,
     }
   }
 
+  if (!mResponse) {
+    MOZ_ASSERT(false);
+    return NS_ERROR_UNEXPECTED;
+  }
+
   // Needs to be initialized to 0 because in some cases nsStringInputStream may
   // not write to aRead.
   uint32_t aRead = 0;
-  MOZ_ASSERT(mResponse);
   MOZ_ASSERT(mPipeOutputStream);
 
   // From "Main Fetch" step 19: SRI-part2.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list