From f1f201780c4ce17d69b83192e2e38d36b52e0b7c Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Tue, 7 Jan 2020 18:58:06 +0000 Subject: [PATCH] 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 --- docshell/base/BrowsingContext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 09270f56f427..af0f1c1fe5fa 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -1502,6 +1502,7 @@ bool IPDLParamTraits::Read( RefPtr 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::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; }