Bug 620306 - Crash [@ nsFtpState::Init] for oom from BeginWriting(); r=biesi
authortimeless <timeless@bemail.org>
Sun, 21 Aug 2011 09:27:29 +0100
changeset 75612 13010f8b9fe1d2920b5d77d305ae66983cd053d8
parent 75611 b727463566a158c1696fc0c464ab96a109032f09
child 75613 95996d0763a6b739ac9db4e472aa031ce7961f40
push id1370
push userbmo@edmorley.co.uk
push dateSun, 21 Aug 2011 08:30:12 +0000
treeherdermozilla-inbound@857f058efa56 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbiesi
bugs620306
milestone9.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 620306 - Crash [@ nsFtpState::Init] for oom from BeginWriting(); r=biesi
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -1693,17 +1693,19 @@ nsFtpState::Init(nsFtpChannel *channel)
     } else {
         rv = mChannel->URI()->GetPath(path);
     }
     if (NS_FAILED(rv))
         return rv;
 
     // Skip leading slash
     char *fwdPtr = path.BeginWriting();
-    if (fwdPtr && (*fwdPtr == '/'))
+    if (!fwdPtr)
+        return NS_ERROR_OUT_OF_MEMORY;
+    if (*fwdPtr == '/')
         fwdPtr++;
     if (*fwdPtr != '\0') {
         // now unescape it... %xx reduced inline to resulting character
         PRInt32 len = NS_UnescapeURL(fwdPtr);
         mPath.Assign(fwdPtr, len);
         if (IsUTF8(mPath)) {
     	    nsCAutoString originCharset;
     	    rv = mChannel->URI()->GetOriginCharset(originCharset);