Bug 1359369 - prevent null pointer dereference in NS_GetIsDocumentChannel. r=valentin
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 25 Apr 2017 14:38:03 +0300
changeset 402872 9517822fdfa7d21b073872a6fc9faa9e65f06ec1
parent 402871 6c67c4f0bf30b8453d1fd9d8dc6f66319449aeb1
child 402873 3c2c6b5eb8812c59a410ce51a82ea3aefbefb713
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1359369
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1359369 - prevent null pointer dereference in NS_GetIsDocumentChannel. r=valentin MozReview-Commit-ID: I1iu2miXmjZ
netwerk/base/nsNetUtil.cpp
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -361,20 +361,20 @@ NS_NewChannel(nsIChannel           **out
 nsresult
 NS_GetIsDocumentChannel(nsIChannel * aChannel, bool *aIsDocument)
 {
   // Check if this channel is going to be used to create a document. If it has
   // LOAD_DOCUMENT_URI set it is trivially creating a document. If
   // LOAD_HTML_OBJECT_DATA is set it may or may not be used to create a
   // document, depending on its MIME type.
 
-  *aIsDocument = false;
   if (!aChannel || !aIsDocument) {
       return NS_ERROR_NULL_POINTER;
   }
+  *aIsDocument = false;
   nsLoadFlags loadFlags;
   nsresult rv = aChannel->GetLoadFlags(&loadFlags);
   if (NS_FAILED(rv)) {
       return rv;
   }
   if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) {
       *aIsDocument = true;
       return NS_OK;