Bug 1166349: Use a fallible allocation in nsXMLHttpRequest::StreamReaderFunc. r=smaug

This commit is contained in:
David Major
2015-05-20 10:32:54 -04:00
parent 203f72b832
commit 3e1112714f

View File

@@ -1857,8 +1857,7 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
xmlHttpRequest->mResponseXML) {
// Copy for our own use
uint32_t previousLength = xmlHttpRequest->mResponseBody.Length();
xmlHttpRequest->mResponseBody.Append(fromRawSegment,count);
if (count > 0 && xmlHttpRequest->mResponseBody.Length() == previousLength) {
if (!xmlHttpRequest->mResponseBody.Append(fromRawSegment, count, fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
} else if (xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||