Title: [123409] trunk
Revision
123409
Author
[email protected]
Date
2012-07-23 17:37:36 -0700 (Mon, 23 Jul 2012)

Log Message

Fixed crash in webkitAddKey() when key parameter is null.
https://bugs.webkit.org/show_bug.cgi?id=85444

Patch by David Dorwin <[email protected]> on 2012-07-23
Reviewed by Kentaro Hara.

Reference: Step 1 of http://dvcs.w3.org/hg/html-media/raw-file/5f76a0b43836/encrypted-media/encrypted-media.html#dom-addkey

Source/WebCore:

Tests: media/encrypted-media/encrypted-media-syntax.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::webkitAddKey):

LayoutTests:

* media/encrypted-media/encrypted-media-syntax-expected.txt:
* media/encrypted-media/encrypted-media-syntax.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123408 => 123409)


--- trunk/LayoutTests/ChangeLog	2012-07-24 00:36:21 UTC (rev 123408)
+++ trunk/LayoutTests/ChangeLog	2012-07-24 00:37:36 UTC (rev 123409)
@@ -1,3 +1,15 @@
+2012-07-23  David Dorwin  <[email protected]>
+
+        Fixed crash in webkitAddKey() when key parameter is null.
+        https://bugs.webkit.org/show_bug.cgi?id=85444
+
+        Reviewed by Kentaro Hara.
+
+        Reference: Step 1 of http://dvcs.w3.org/hg/html-media/raw-file/5f76a0b43836/encrypted-media/encrypted-media.html#dom-addkey
+
+        * media/encrypted-media/encrypted-media-syntax-expected.txt:
+        * media/encrypted-media/encrypted-media-syntax.html:
+
 2012-07-23  Tony Chang  <[email protected]>
 
         http/tests/multipart/policy-ignore-crash.php is failing on Chromium

Modified: trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax-expected.txt (123408 => 123409)


--- trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax-expected.txt	2012-07-24 00:36:21 UTC (rev 123408)
+++ trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax-expected.txt	2012-07-24 00:37:36 UTC (rev 123409)
@@ -19,6 +19,11 @@
 TEST(video.webkitCancelKeyRequest(null)) THROWS(DOMException.SYNTAX_ERR) OK
 TEST(video.webkitCancelKeyRequest(undefined)) THROWS(DOMException.SYNTAX_ERR) OK
 
+null key is caught before load state is checked.
+TEST(video.webkitAddKey('webkit-org.w3.clearkey', '')) THROWS(DOMException.SYNTAX_ERR) OK
+TEST(video.webkitAddKey('webkit-org.w3.clearkey', null)) THROWS(DOMException.SYNTAX_ERR) OK
+TEST(video.webkitAddKey('webkit-org.w3.clearkey', undefined)) THROWS(DOMException.SYNTAX_ERR) OK
+
 0-length key is caught before load state is checked.
 TEST(video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())) THROWS(DOMException.TYPE_MISMATCH_ERR) OK
 

Modified: trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax.html (123408 => 123409)


--- trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax.html	2012-07-24 00:36:21 UTC (rev 123408)
+++ trunk/LayoutTests/media/encrypted-media/encrypted-media-syntax.html	2012-07-24 00:37:36 UTC (rev 123409)
@@ -42,6 +42,7 @@
 
             consoleWrite("<br>Verify invalid key system parameter is caught before checking whether loading has started.");
             // If the above was not the case, all of these would be INVALID_STATE_ERR.
+            // Also tests "null" case for first parameter.
             testExpected("video.networkState", video.NETWORK_EMPTY);
             testExpected("video.currentSrc", "");
             testException("video.webkitGenerateKeyRequest('')", "DOMException.SYNTAX_ERR");
@@ -54,6 +55,11 @@
             testException("video.webkitCancelKeyRequest(null)", "DOMException.SYNTAX_ERR");
             testException("video.webkitCancelKeyRequest(undefined)", "DOMException.SYNTAX_ERR");
 
+            consoleWrite("<br>null key is caught before load state is checked.");
+            testException("video.webkitAddKey('webkit-org.w3.clearkey', '')", "DOMException.SYNTAX_ERR");
+            testException("video.webkitAddKey('webkit-org.w3.clearkey', null)", "DOMException.SYNTAX_ERR");
+            testException("video.webkitAddKey('webkit-org.w3.clearkey', undefined)", "DOMException.SYNTAX_ERR");
+
             consoleWrite("<br>0-length key is caught before load state is checked.");
             testException("video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())", "DOMException.TYPE_MISMATCH_ERR");
 

Modified: trunk/Source/WebCore/ChangeLog (123408 => 123409)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 00:36:21 UTC (rev 123408)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 00:37:36 UTC (rev 123409)
@@ -1,3 +1,17 @@
+2012-07-23  David Dorwin  <[email protected]>
+
+        Fixed crash in webkitAddKey() when key parameter is null.
+        https://bugs.webkit.org/show_bug.cgi?id=85444
+
+        Reviewed by Kentaro Hara.
+
+        Reference: Step 1 of http://dvcs.w3.org/hg/html-media/raw-file/5f76a0b43836/encrypted-media/encrypted-media.html#dom-addkey
+
+        Tests: media/encrypted-media/encrypted-media-syntax.html 
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::webkitAddKey):
+
 2012-07-23  Hayato Ito  <[email protected]>
 
         A FocusScope for a distributed node should not be its TreeScope.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (123408 => 123409)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-07-24 00:36:21 UTC (rev 123408)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-07-24 00:37:36 UTC (rev 123409)
@@ -2557,6 +2557,11 @@
         return;
     }
 
+    if (!key) {
+        ec = SYNTAX_ERR;
+        return;
+    }
+
     if (!key->length()) {
         ec = TYPE_MISMATCH_ERR;
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to