Bug 1147730 part 2 - Validate input rather than not-yet-set data field in MediaKeySession::SetSessionId. r=jw_wang
authorChris Pearce <cpearce@mozilla.com>
Thu, 26 Mar 2015 19:53:23 +1300
changeset 266106 bd65fd7d5cc0cf144b318b84fa400002ff7ca1a0
parent 266105 71ba4f1e5d8d355629a03b734107080286d59b21
child 266107 ae55f70e6baa3077035a63de3c60de9967b2b619
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjw_wang
bugs1147730
milestone39.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 1147730 part 2 - Validate input rather than not-yet-set data field in MediaKeySession::SetSessionId. r=jw_wang
dom/media/eme/CDMProxy.cpp
dom/media/eme/MediaKeySession.cpp
--- a/dom/media/eme/CDMProxy.cpp
+++ b/dom/media/eme/CDMProxy.cpp
@@ -391,17 +391,19 @@ CDMProxy::OnSetSessionId(uint32_t aCreat
                          const nsAString& aSessionId)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mKeys.IsNull()) {
     return;
   }
 
   nsRefPtr<dom::MediaKeySession> session(mKeys->GetPendingSession(aCreateSessionToken));
-  session->SetSessionId(aSessionId);
+  if (session) {
+    session->SetSessionId(aSessionId);
+  }
 }
 
 void
 CDMProxy::OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mKeys.IsNull()) {
     return;
--- a/dom/media/eme/MediaKeySession.cpp
+++ b/dom/media/eme/MediaKeySession.cpp
@@ -61,17 +61,17 @@ MediaKeySession::MediaKeySession(JSConte
     return;
   }
   mClosed = mKeys->MakePromise(aRv);
 }
 
 void MediaKeySession::SetSessionId(const nsAString& aSessionId)
 {
   EME_LOG("MediaKeySession[%p,'%s'] session Id set",
-          this, NS_ConvertUTF16toUTF8(mSessionId).get());
+          this, NS_ConvertUTF16toUTF8(aSessionId).get());
 
   if (NS_WARN_IF(!mSessionId.IsEmpty())) {
     return;
   }
   mSessionId = aSessionId;
   mKeys->OnSessionIdReady(this);
 }