From bcdf20a7576f7117fa3bc8a1a7306f88f14ad3ac Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 23 Aug 2014 23:47:55 -0500 Subject: [PATCH] Bug 1057175. If ReadSegments returns a failure code it might not send any data to RasterImage, so check for return value. r=seth We can hit this if the input stream gets closed before we can read from it. In the case I debugged the image was removed from the DOM (by having it's containing document removed from the DOM) so it's request was cancelled. ReadSegments on a closed stream (at least a cache file input stream) just returns and does nothing. --- image/src/RasterImage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 0db86106429..edb5f7e7125 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -1822,8 +1822,9 @@ RasterImage::OnImageDataAvailable(nsIRequest*, uint32_t bytesRead; rv = aInStr->ReadSegments(WriteToRasterImage, this, aCount, &bytesRead); - NS_ABORT_IF_FALSE(bytesRead == aCount || HasError(), - "WriteToRasterImage should consume everything or the image must be in error!"); + NS_ABORT_IF_FALSE(bytesRead == aCount || HasError() || NS_FAILED(rv), + "WriteToRasterImage should consume everything if ReadSegments succeeds or " + "the image must be in error!"); return rv; }