Bug 1482452 - p2: validate object before sending to Java runtime. r=snorp
authorJohn Lin <jolin@mozilla.com>
Wed, 16 Jan 2019 16:31:19 +0000
changeset 511236 ba98166b6967ed4aeba972531b3488742c8339a0
parent 511235 0be55928fcb7ed372ee3f6aca33e5c7516593a2d
child 511237 0b1911ea8b8b9168ec413904aae1bdab30d5ad87
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1482452
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482452 - p2: validate object before sending to Java runtime. r=snorp Depends on D16707 Differential Revision: https://phabricator.services.mozilla.com/D16708
dom/media/platforms/android/RemoteDataDecoder.cpp
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -128,16 +128,20 @@ class RemoteVideoDecoder : public Remote
     }
 
     mSurfaceHandle = mSurface->GetHandle();
 
     // Register native methods.
     JavaCallbacksSupport::Init();
 
     mJavaCallbacks = CodecProxy::NativeCallbacks::New();
+    if (!mJavaCallbacks) {
+      return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
+                                          __func__);
+    }
     JavaCallbacksSupport::AttachNative(
         mJavaCallbacks, mozilla::MakeUnique<CallbacksSupport>(this));
 
     mJavaDecoder = CodecProxy::Create(
         false,  // false indicates to create a decoder and true denotes encoder
         mFormat, mSurface, mJavaCallbacks, mDrmStubId);
     if (mJavaDecoder == nullptr) {
       return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
@@ -320,16 +324,20 @@ class RemoteAudioDecoder : public Remote
     }
   }
 
   RefPtr<InitPromise> Init() override {
     // Register native methods.
     JavaCallbacksSupport::Init();
 
     mJavaCallbacks = CodecProxy::NativeCallbacks::New();
+    if (!mJavaCallbacks) {
+      return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
+                                          __func__);
+    }
     JavaCallbacksSupport::AttachNative(
         mJavaCallbacks, mozilla::MakeUnique<CallbacksSupport>(this));
 
     mJavaDecoder =
         CodecProxy::Create(false, mFormat, nullptr, mJavaCallbacks, mDrmStubId);
     if (mJavaDecoder == nullptr) {
       return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                                           __func__);