fix crash sorting large folders by subject, r=neil@parkwaycc, sr=mscott 230251

This commit is contained in:
bienvenu%nventure.com 2004-01-07 16:08:48 +00:00
Родитель 60d24d7b7a
Коммит 9c4d5c975d
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -3464,9 +3464,12 @@ NS_IMETHODIMP nsMsgDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOr
// pTemp - pBase = the space we have used so far
// sizeof(EntryInfo) + fieldLen = space we need for this entry
// allocSize = size of the current block
if ((PRUint32)(pTemp - pBase) + (keyOffset + actualFieldLen) >= allocSize) {
if ((PRUint32)(pTemp - pBase) + (keyOffset + actualFieldLen) >= allocSize)
{
maxSize = (keyOffset + maxLen) * (arraySize - numSoFar);
allocSize = PR_MIN(maxBlockSize, maxSize);
// make sure allocSize is big enough for the current value
allocSize = PR_MAX(allocSize, keyOffset + actualFieldLen);
pTemp = (char *) PR_Malloc(allocSize);
NS_ASSERTION(pTemp, "out of memory, can't sort");
if (!pTemp)