зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1148286 - Ensure we don't nullpointer deref if the CDM crashes in MediaKeys and Reader::SetCDMProxy implementations. r=edwin
This commit is contained in:
Родитель
987f3c1f53
Коммит
f800285f02
|
@ -153,6 +153,12 @@ MediaKeys::SetServerCertificate(const ArrayBufferViewOrArrayBuffer& aCert, Error
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mProxy) {
|
||||
NS_WARNING("Tried to use a MediaKeys without a CDM");
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsTArray<uint8_t> data;
|
||||
if (!CopyArrayBufferViewOrArrayBufferData(aCert, data)) {
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
|
@ -487,6 +493,12 @@ MediaKeys::CreateSession(JSContext* aCx,
|
|||
SessionType aSessionType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!mProxy) {
|
||||
NS_WARNING("Tried to use a MediaKeys which lost its CDM");
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EME_LOG("MediaKeys[%p] Creating session", this);
|
||||
|
||||
nsRefPtr<MediaKeySession> session = new MediaKeySession(aCx,
|
||||
|
|
|
@ -42,7 +42,7 @@ MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
|
|||
{
|
||||
nsresult rv = MediaDecoder::SetCDMProxy(aProxy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
{
|
||||
if (aProxy) {
|
||||
// The MP4Reader can't decrypt EME content until it has a CDMProxy,
|
||||
// and the CDMProxy knows the capabilities of the CDM. The MP4Reader
|
||||
// remains in "waiting for resources" state until then.
|
||||
|
|
|
@ -305,7 +305,7 @@ MediaSourceDecoder::SetCDMProxy(CDMProxy* aProxy)
|
|||
rv = mReader->SetCDMProxy(aProxy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
{
|
||||
if (aProxy) {
|
||||
// The sub readers can't decrypt EME content until they have a CDMProxy,
|
||||
// and the CDMProxy knows the capabilities of the CDM. The MediaSourceReader
|
||||
// remains in "waiting for resources" state until then. We need to kick the
|
||||
|
|
Загрузка…
Ссылка в новой задаче