зеркало из https://github.com/mozilla/gecko-dev.git
Bug 673808 - _CACHE_MAP_ is storing nsDiskCacheRecord structs with uninitialized data containing bits of Fx memory
This commit is contained in:
Родитель
46b893fa86
Коммит
df17fe214d
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче