bug 499203 null deref in nsprotocolproxyservice::getprotocolinfo with null nsiuri r=biesi
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 05 Sep 2012 08:44:27 -0400
changeset 104292 20e483ab67ae724e6a7493c84d4af17a73bec804
parent 104291 b0203e3c174cc5d0e0acbe7105fa08465c4b4962
child 104293 d625d938c36d990145f725a9812038064b9ff47c
push id23417
push userryanvm@gmail.com
push dateThu, 06 Sep 2012 02:27:31 +0000
treeherdermozilla-central@501f4e46a88c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbiesi
bugs499203
milestone18.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 499203 null deref in nsprotocolproxyservice::getprotocolinfo with null nsiuri r=biesi
netwerk/base/src/nsProtocolProxyService.cpp
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -814,16 +814,18 @@ nsProtocolProxyService::ReloadPAC()
     return NS_OK;
 }
 
 // nsIProtocolProxyService
 NS_IMETHODIMP
 nsProtocolProxyService::Resolve(nsIURI *uri, uint32_t flags,
                                 nsIProxyInfo **result)
 {
+    NS_ENSURE_ARG_POINTER(uri);
+
     nsProtocolInfo info;
     nsresult rv = GetProtocolInfo(uri, &info);
     if (NS_FAILED(rv))
         return rv;
 
     bool usePAC;
     rv = Resolve_Internal(uri, info, flags, &usePAC, result);
     if (NS_FAILED(rv)) {
@@ -859,16 +861,19 @@ nsProtocolProxyService::Resolve(nsIURI *
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProtocolProxyService::AsyncResolve(nsIURI *uri, uint32_t flags,
                                      nsIProtocolProxyCallback *callback,
                                      nsICancelable **result)
 {
+    NS_ENSURE_ARG_POINTER(uri);
+    NS_ENSURE_ARG_POINTER(callback);
+
     nsRefPtr<nsAsyncResolveRequest> ctx =
         new nsAsyncResolveRequest(this, uri, flags, callback);
     if (!ctx)
         return NS_ERROR_OUT_OF_MEMORY;
 
     nsProtocolInfo info;
     nsresult rv = GetProtocolInfo(uri, &info);
     if (NS_FAILED(rv))
@@ -1168,16 +1173,19 @@ nsProtocolProxyService::LoadHostFilters(
 loser:
         delete hinfo;
     }
 }
 
 nsresult
 nsProtocolProxyService::GetProtocolInfo(nsIURI *uri, nsProtocolInfo *info)
 {
+    NS_PRECONDITION(uri, "URI is null");
+    NS_PRECONDITION(info, "info is null");
+
     nsresult rv;
 
     rv = uri->GetScheme(info->scheme);
     if (NS_FAILED(rv))
         return rv;
 
     nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
     if (NS_FAILED(rv))