Bug 673808 - _CACHE_MAP_ is storing nsDiskCacheRecord structs with uninitialized data containing bits of Fx memory

This commit is contained in:
Michal Novotny 2011-07-26 13:09:42 +02:00
Родитель 46b893fa86
Коммит df17fe214d
1 изменённых файлов: 4 добавлений и 3 удалений

7
netwerk/cache/nsDiskCacheMap.cpp поставляемый
Просмотреть файл

@ -311,6 +311,10 @@ nsDiskCacheMap::GrowRecords()
if (!newArray)
return NS_ERROR_OUT_OF_MEMORY;
// clear the new uninitialized memory
memset(newArray + mHeader.mRecordCount, 0,
(newCount - mHeader.mRecordCount) * sizeof(nsDiskCacheRecord));
// Space out the buckets
PRUint32 oldRecordsPerBucket = GetRecordsPerBucket();
PRUint32 newRecordsPerBucket = newCount / kBuckets;
@ -322,9 +326,6 @@ nsDiskCacheMap::GrowRecords()
memmove(newRecords,
newArray + bucketIndex * oldRecordsPerBucket,
count * sizeof(nsDiskCacheRecord));
// Clear the new empty entries
for (PRUint32 i = count; i < newRecordsPerBucket; ++i)
newRecords[i].SetHashNumber(0);
}
// Set as the new record array