From 56ad29a9d5bfba3074ace5af8b3ebdef5a8e1046 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Thu, 26 Mar 2015 19:53:23 +1300 Subject: [PATCH] Bug 1147730 part 2 - Validate input rather than not-yet-set data field in MediaKeySession::SetSessionId. r=jw_wang --- dom/media/eme/CDMProxy.cpp | 4 +++- dom/media/eme/MediaKeySession.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/media/eme/CDMProxy.cpp b/dom/media/eme/CDMProxy.cpp index 3174347bd1f8..278dc92cda07 100644 --- a/dom/media/eme/CDMProxy.cpp +++ b/dom/media/eme/CDMProxy.cpp @@ -396,7 +396,9 @@ CDMProxy::OnSetSessionId(uint32_t aCreateSessionToken, } nsRefPtr session(mKeys->GetPendingSession(aCreateSessionToken)); - session->SetSessionId(aSessionId); + if (session) { + session->SetSessionId(aSessionId); + } } void diff --git a/dom/media/eme/MediaKeySession.cpp b/dom/media/eme/MediaKeySession.cpp index 87de878e2eb9..5fd9e98d0d9b 100644 --- a/dom/media/eme/MediaKeySession.cpp +++ b/dom/media/eme/MediaKeySession.cpp @@ -66,7 +66,7 @@ MediaKeySession::MediaKeySession(JSContext* aCx, 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;