Bug 616591 - Firefox 4.0b8pre crash in [@ nsHttpPipeline::GetConnectionInfo(nsHttpConnectionInfo**]; r=bzbarsky a=blocking-beta8+
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 04 Dec 2010 04:21:03 -0500
changeset 58661 2b63604957e2f5b9c01e47d4b2e1dfe153377627
parent 58660 9d0841ea7e3baf4e332d67980f0880eaecf2f231
child 58662 a7adfbb051fd913f777df204a19f2fce7154703b
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbzbarsky, blocking-beta8
bugs616591
milestone2.0b8pre
Bug 616591 - Firefox 4.0b8pre crash in [@ nsHttpPipeline::GetConnectionInfo(nsHttpConnectionInfo**]; r=bzbarsky a=blocking-beta8+
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -817,21 +817,25 @@ nsHttpTransaction::ParseHead(char *buf,
     if (!mHttpResponseMatched) {
         // If HTTP 0.9 response is allowed (i.e. neither 1.0 nor 1.1 was yet
         // received on the connection) then do a simple junk detection.
         // Otherwise find a HTTP response.
 
         // Value returned by IsHttp09Allowed() can change between calls to this
         // method, but it can change only from PR_TRUE to PR_FALSE and this is
         // OK since we can enter this statement multiple time only when the
-        // value id PR_FALSE.
+        // value is PR_FALSE.
         nsRefPtr<nsHttpConnectionInfo> ci;
-        mConnection->GetConnectionInfo(getter_AddRefs(ci));
+        if (mConnection) {
+            mConnection->GetConnectionInfo(getter_AddRefs(ci));
+        }
 
-        if (ci->IsHttp09Allowed()) {
+        // If the connection information is not available, we can't have a response
+        // body, so it doens't make sense to look for jumk in it.
+        if (ci && ci->IsHttp09Allowed()) {
             // tolerate some junk before the status line
             mHttpResponseMatched = PR_TRUE;
             char *p = LocateHttpStart(buf, PR_MIN(count, 8), PR_TRUE);
             if (!p) {
                 // Treat any 0.9 style response of a put as a failure.
                 if (mRequestHead->Method() == nsHttp::Put)
                     return NS_ERROR_ABORT;