From a9e502ba951b2e1527b87634781a6fdd9c7265f9 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Tue, 28 Nov 2006 01:14:29 +0000 Subject: [PATCH] move ns_ensure_true in to the right block. bug 333253. r=vlad --- modules/libpr0n/decoders/icon/nsIconDecoder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/libpr0n/decoders/icon/nsIconDecoder.cpp b/modules/libpr0n/decoders/icon/nsIconDecoder.cpp index 7818e83cf4d..2ec0e77b85a 100644 --- a/modules/libpr0n/decoders/icon/nsIconDecoder.cpp +++ b/modules/libpr0n/decoders/icon/nsIconDecoder.cpp @@ -143,9 +143,6 @@ NS_IMETHODIMP nsIconDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR mFrame->GetWidth(&width); mFrame->GetHeight(&height); - NS_ENSURE_TRUE(buf_end - data >= PRInt32(bpr + abpr) * height, - NS_ERROR_UNEXPECTED); - PRInt32 rownum; #if defined(MOZ_CAIRO_GFX) PRUint8 *row = (PRUint8*)malloc(bpr); @@ -175,6 +172,9 @@ NS_IMETHODIMP nsIconDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR } free(row); #else + NS_ENSURE_TRUE(buf_end - data >= PRInt32(bpr + abpr) * height, + NS_ERROR_UNEXPECTED); + for (rownum = 0; rownum < height; ++rownum, data += bpr) mFrame->SetImageData(data, bpr, rownum * bpr);