From d8518e56ab15208aa5331e14a55db39561c3b81e Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Wed, 6 Sep 2017 10:38:13 -0600 Subject: [PATCH] Bug 1383501: Move stream creation below buffer size check in mscom::ProxyStream::ProxyStream; r=jimm MozReview-Commit-ID: fG4an6mSiR --- ipc/mscom/ProxyStream.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ipc/mscom/ProxyStream.cpp b/ipc/mscom/ProxyStream.cpp index a2b2336c82ed..07bf26660d0c 100644 --- a/ipc/mscom/ProxyStream.cpp +++ b/ipc/mscom/ProxyStream.cpp @@ -49,6 +49,15 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf, NS_NAMED_LITERAL_CSTRING(kCrashReportKey, "ProxyStreamUnmarshalStatus"); #endif + if (!aInitBufSize) { +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport(kCrashReportKey, + NS_LITERAL_CSTRING("!aInitBufSize")); +#endif // defined(MOZ_CRASHREPORTER) + // We marshaled a nullptr. Nothing else to do here. + return; + } + HRESULT createStreamResult = CreateStream(aInitBuf, aInitBufSize, getter_AddRefs(mStream)); if (FAILED(createStreamResult)) { @@ -59,14 +68,6 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf, return; } - if (!aInitBufSize) { -#if defined(MOZ_CRASHREPORTER) - CrashReporter::AnnotateCrashReport(kCrashReportKey, - NS_LITERAL_CSTRING("!aInitBufSize")); -#endif // defined(MOZ_CRASHREPORTER) - // We marshaled a nullptr. Nothing else to do here. - return; - } // NB: We can't check for a null mStream until after we have checked for // the zero aInitBufSize above. This is because InitStream will also fail // in that case, even though marshaling a nullptr is allowable.