Title: [263601] trunk
Revision
263601
Author
[email protected]
Date
2020-06-26 16:38:31 -0700 (Fri, 26 Jun 2020)

Log Message

CRASH: incompatible downcast<> operation in SourceBufferPrivateAVFObjC::setCDMInstance()
https://bugs.webkit.org/show_bug.cgi?id=213660
<rdar://problem/63831593>

Reviewed by Eric Carlson.

Source/WebCore:

Test: platform/mac/media/encrypted-media/fps-clearkey-crash.html

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):

LayoutTests:

* platform/mac/media/encrypted-media/fps-clearkey-crash-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-clearkey-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (263600 => 263601)


--- trunk/LayoutTests/ChangeLog	2020-06-26 23:37:39 UTC (rev 263600)
+++ trunk/LayoutTests/ChangeLog	2020-06-26 23:38:31 UTC (rev 263601)
@@ -1,3 +1,14 @@
+2020-06-26  Jer Noble  <[email protected]>
+
+        CRASH: incompatible downcast<> operation in SourceBufferPrivateAVFObjC::setCDMInstance()
+        https://bugs.webkit.org/show_bug.cgi?id=213660
+        <rdar://problem/63831593>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/media/encrypted-media/fps-clearkey-crash-expected.txt: Added.
+        * platform/mac/media/encrypted-media/fps-clearkey-crash.html: Added.
+
 2020-06-26  Chris Dumez  <[email protected]>
 
         Update web-platform-tests/WebCryptoAPI from upstream

Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash-expected.txt (0 => 263601)


--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash-expected.txt	2020-06-26 23:38:31 UTC (rev 263601)
@@ -0,0 +1,8 @@
+
+Tests that creating an incompatible MediaKeys object with MediaSource does not crash.
+EVENT(sourceopen)
+EVENT(update)
+requestMediaKeySystemAccess promise resolved
+createMediaKeys promise resolved
+END OF TEST
+

Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash.html (0 => 263601)


--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-clearkey-crash.html	2020-06-26 23:38:31 UTC (rev 263601)
@@ -0,0 +1,46 @@
+<html>
+<head>
+    <title>media-source-change-source</title>
+    <script src=""
+    <script src=""
+    <script>
+    let loader;
+    let source;
+    let sourceBuffer;
+
+    window.addEventListener('load', async event => {
+        consoleWrite('Tests that creating an incompatible MediaKeys object with MediaSource does not crash.')
+        findMediaElement();
+        loader = new MediaSourceLoader('../../../../media/media-source/content/test-fragmented-manifest.json', '../../../../media/media-source/');
+        let loaderPromise = new Promise((resolve, reject) => {
+            loader._onload_ = resolve;
+            loader._onerror_ = reject;
+        })
+        await loaderPromise;
+
+        source = new MediaSource();
+        video.src = ""
+        await waitFor(source, 'sourceopen'),
+
+        sourceBuffer = source.addSourceBuffer('video/mp4');
+        sourceBuffer.appendBuffer(loader.initSegment());
+        await waitFor(sourceBuffer, 'update');
+
+
+        let access = await navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{
+            initDataTypes: ["cenc"],
+            videoCapabilities: [{contentType : 'video/mp4; codecs="avc1.64001F"'}]
+        }]);
+        consoleWrite('requestMediaKeySystemAccess promise resolved');
+
+        let keys = await access.createMediaKeys();
+        video.setMediaKeys(keys);
+        consoleWrite('createMediaKeys promise resolved');
+        endTest();
+    });
+    </script>
+</head>
+<body>
+<video controls></video><br>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (263600 => 263601)


--- trunk/Source/WebCore/ChangeLog	2020-06-26 23:37:39 UTC (rev 263600)
+++ trunk/Source/WebCore/ChangeLog	2020-06-26 23:38:31 UTC (rev 263601)
@@ -1,3 +1,16 @@
+2020-06-26  Jer Noble  <[email protected]>
+
+        CRASH: incompatible downcast<> operation in SourceBufferPrivateAVFObjC::setCDMInstance()
+        https://bugs.webkit.org/show_bug.cgi?id=213660
+        <rdar://problem/63831593>
+
+        Reviewed by Eric Carlson.
+
+        Test: platform/mac/media/encrypted-media/fps-clearkey-crash.html
+
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
+
 2020-06-26  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] Add support for <center>

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (263600 => 263601)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2020-06-26 23:37:39 UTC (rev 263600)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2020-06-26 23:38:31 UTC (rev 263601)
@@ -964,7 +964,7 @@
 void SourceBufferPrivateAVFObjC::setCDMInstance(CDMInstance* instance)
 {
 #if ENABLE(ENCRYPTED_MEDIA) && HAVE(AVCONTENTKEYSESSION)
-    auto* fpsInstance = downcast<CDMInstanceFairPlayStreamingAVFObjC>(instance);
+    auto* fpsInstance = is<CDMInstanceFairPlayStreamingAVFObjC>(instance) ? downcast<CDMInstanceFairPlayStreamingAVFObjC>(instance) : nullptr;
     if (fpsInstance == m_cdmInstance)
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to