зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1276724 - Make two url-classifier allocations fallible. r=gcp.
This addresses two crashes in the top #75 on 47.0.1.
This commit is contained in:
Родитель
9f39a5920a
Коммит
b89b0e13a4
|
@ -787,7 +787,9 @@ HashStore::WriteAddPrefixes(nsIOutputStream* aOut)
|
||||||
{
|
{
|
||||||
nsTArray<uint32_t> chunks;
|
nsTArray<uint32_t> chunks;
|
||||||
uint32_t count = mAddPrefixes.Length();
|
uint32_t count = mAddPrefixes.Length();
|
||||||
chunks.SetCapacity(count);
|
if (!chunks.SetCapacity(count, fallible)) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
chunks.AppendElement(mAddPrefixes[i].Chunk());
|
chunks.AppendElement(mAddPrefixes[i].Chunk());
|
||||||
|
|
|
@ -564,7 +564,9 @@ LookupCache::ConstructPrefixSet(AddPrefixArray& aAddPrefixes)
|
||||||
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer;
|
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer;
|
||||||
|
|
||||||
nsTArray<uint32_t> array;
|
nsTArray<uint32_t> array;
|
||||||
array.SetCapacity(aAddPrefixes.Length());
|
if (!array.SetCapacity(aAddPrefixes.Length(), fallible)) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < aAddPrefixes.Length(); i++) {
|
for (uint32_t i = 0; i < aAddPrefixes.Length(); i++) {
|
||||||
array.AppendElement(aAddPrefixes[i].PrefixHash().ToUint32());
|
array.AppendElement(aAddPrefixes[i].PrefixHash().ToUint32());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче