Bugzilla Bug 111830 freeze/hang when retrieving malformed response for GET /favicon.ico

patch by cbiesinger@web.de r=pavlov sr=hyatt


git-svn-id: svn://10.0.0.236/trunk@110710 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mac.com 2001-12-18 13:27:52 +00:00
parent 48b907118d
commit 54b104a557

View File

@ -122,7 +122,7 @@ inline nsresult nsICODecoder::SetAlphaData()
nsICODecoder::nsICODecoder()
{
NS_INIT_ISUPPORTS();
mPos = mNumColors = mCurLine = mRowBytes = mImageOffset = mCurrIcon = 0;
mPos = mNumColors = mCurLine = mRowBytes = mImageOffset = mCurrIcon = mNumIcons = 0;
mColors = nsnull;
mRow = nsnull;
mDecodingAndMask = PR_FALSE;
@ -232,6 +232,8 @@ nsresult nsICODecoder::ProcessData(const char* aBuffer, PRUint32 aCount) {
aCount -= toCopy;
aBuffer += toCopy;
}
if (aCount == 0)
return NS_OK; // Need more data
if (mPos == 22+mCurrIcon*sizeof(mDirEntryArray)) {
mCurrIcon++;
@ -357,7 +359,7 @@ nsresult nsICODecoder::ProcessData(const char* aBuffer, PRUint32 aCount) {
aBuffer += toCopy;
mRowBytes += toCopy;
}
if ((rowSize - mRowBytes) == 0) {
if (rowSize == mRowBytes) {
#if defined(XP_MAC) || defined(XP_MACOSX)
PRUint8* decoded = mDecodedBuffer+((mCurLine-1)*mDirEntry.mWidth*4);
#else