зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552900 - Crash on OOM in ICU on Nightly builds; r=jandem,platform-i18n-reviewers
We're seeing inconsistent handling of OOMs in the ICU library. This patch changes the behaviour to crash on OOM rather than allowing ICU to handle the allocation failure. The inconsistent handling in ICU could lead to ICU being in an inconsistent state which could in turn cause security problems. The safer alternative is to crash, but it's possible this will lead to too high of crash rate. For now, we'll try this on Nightly only and monitor crash reports to see what impact this change has. Differential Revision: https://phabricator.services.mozilla.com/D186226
This commit is contained in:
Родитель
aa7f4151d4
Коммит
2a1cba56aa
|
@ -163,11 +163,27 @@ class ICUReporter final : public nsIMemoryReporter,
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
static void* Alloc(const void*, size_t aSize) {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
void* result = CountingMalloc(aSize);
|
||||
if (result == nullptr) {
|
||||
MOZ_CRASH("Ran out of memory while allocating for ICU");
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return CountingMalloc(aSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* Realloc(const void*, void* aPtr, size_t aSize) {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
void* result = CountingRealloc(aPtr, aSize);
|
||||
if (result == nullptr) {
|
||||
MOZ_CRASH("Ran out of memory while reallocating for ICU");
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return CountingRealloc(aPtr, aSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Free(const void*, void* aPtr) { return CountingFree(aPtr); }
|
||||
|
|
Загрузка…
Ссылка в новой задаче