Bug 1605514 - Avoid hard-crashing on malformed data while fuzzing, r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D58986

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2020-01-07 18:58:06 +00:00
Родитель 9e26acd416
Коммит f1f201780c
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -1502,6 +1502,7 @@ bool IPDLParamTraits<dom::BrowsingContext*>::Read(
RefPtr<dom::BrowsingContext> browsingContext = dom::BrowsingContext::Get(id);
if (!browsingContext) {
#ifndef FUZZING
// NOTE: We could fail softly by returning `false` if the `BrowsingContext`
// isn't present, but doing so will cause a crash anyway. Let's improve
// diagnostics by reliably crashing here.
@ -1509,6 +1510,7 @@ bool IPDLParamTraits<dom::BrowsingContext*>::Read(
// If we can recover from failures to deserialize in the future, this crash
// should be removed or modified.
MOZ_CRASH("Attempt to deserialize absent BrowsingContext");
#endif
*aResult = nullptr;
return false;
}