From ddb657b32ded1223973a99c32afe9a1cb5469ac5 Mon Sep 17 00:00:00 2001 From: Jason Duell Date: Wed, 11 Apr 2012 13:26:23 -0700 Subject: [PATCH] Bug 738484 - Handle Location: that won't parse to valid URI. r=mcmanus --- netwerk/protocol/http/nsHttpChannel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 5cc750e6a82d..6db44633ef1f 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -1149,6 +1149,11 @@ nsHttpChannel::ProcessResponse() nsresult nsHttpChannel::ContinueProcessResponse(nsresult rv) { + if (rv == NS_ERROR_CORRUPTED_CONTENT) { + // don't ever render responses we've flagged as suspect content + return NS_ERROR_CORRUPTED_CONTENT; + } + if (rv == NS_ERROR_DOM_BAD_URI && mRedirectURI) { bool isHTTP = false; @@ -3526,7 +3531,11 @@ nsHttpChannel::AsyncProcessRedirection(PRUint32 redirectType) nsresult rv = CreateNewURI(location, getter_AddRefs(mRedirectURI)); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) { + LOG(("Invalid URI for redirect: Location: %s\n", location)); + Cancel(NS_ERROR_CORRUPTED_CONTENT); + return NS_ERROR_CORRUPTED_CONTENT; + } if (mApplicationCache) { // if we are redirected to a different origin check if there is a fallback