Title: [166721] trunk/Source/WebCore
- Revision
- 166721
- Author
- jer.no...@apple.com
- Date
- 2014-04-03 09:26:33 -0700 (Thu, 03 Apr 2014)
Log Message
[EME] Crash when passing a NULL initData to MediaKeys.createSession()
https://bugs.webkit.org/show_bug.cgi?id=131156
Reviewed by Eric Carlson.
Update the checks at the start of createSession() to match the current spec, notably
bailing early if the initData parameter is NULL or empty.
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::createSession):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (166720 => 166721)
--- trunk/Source/WebCore/ChangeLog 2014-04-03 16:03:46 UTC (rev 166720)
+++ trunk/Source/WebCore/ChangeLog 2014-04-03 16:26:33 UTC (rev 166721)
@@ -1,3 +1,16 @@
+2014-04-03 Jer Noble <jer.no...@apple.com>
+
+ [EME] Crash when passing a NULL initData to MediaKeys.createSession()
+ https://bugs.webkit.org/show_bug.cgi?id=131156
+
+ Reviewed by Eric Carlson.
+
+ Update the checks at the start of createSession() to match the current spec, notably
+ bailing early if the initData parameter is NULL or empty.
+
+ * Modules/encryptedmedia/MediaKeys.cpp:
+ (WebCore::MediaKeys::createSession):
+
2014-04-03 Eric Carlson <eric.carl...@apple.com>
[iOS] add missing QuickTime plug-in replacement API
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp (166720 => 166721)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp 2014-04-03 16:03:46 UTC (rev 166720)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp 2014-04-03 16:26:33 UTC (rev 166721)
@@ -89,29 +89,33 @@
// The createSession(type, initData) method must run the following steps:
// Note: The contents of initData are container-specific Initialization Data.
- // 1. If type is null or an empty string and initData is not null or an empty string, throw an
- // INVALID_ACCESS_ERR exception and abort these steps.
- if ((type.isNull() || type.isEmpty()) && (!initData || initData->length())) {
+ // 1. If contentType is null or an empty string, throw an INVALID_ACCESS_ERR exception and abort these steps.
+ if (type.isEmpty()) {
ec = INVALID_ACCESS_ERR;
return 0;
}
- // 2. If type contains a MIME type that is not supported or is not supported by the keySystem, throw
+ // 2. If initData is null or an empty array, throw an INVALID_ACCESS_ERR exception and abort these steps.
+ if (!initData || !initData->length()) {
+ ec = INVALID_ACCESS_ERR;
+ return 0;
+ }
+
+ // 3. If type contains a MIME type that is not supported or is not supported by the keySystem, throw
// a NOT_SUPPORTED_ERR exception and abort these steps.
if (!type.isNull() && !type.isEmpty() && !m_cdm->supportsMIMEType(type)) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
- // 3. Create a new MediaKeySession object.
- // 3.1 Let the keySystem attribute be keySystem.
- // 3.2 Let the sessionId attribute be a unique Session ID string. It may be generated by cdm.
+ // 4. Create a new MediaKeySession object.
+ // 4.1 Let the keySystem attribute be keySystem.
+ // 4.2 Let the sessionId attribute be a unique Session ID string. It may be generated by cdm.
RefPtr<MediaKeySession> session = MediaKeySession::create(context, this, keySystem());
- // 4. Add the new object to an internal list of session objects.
m_sessions.append(session);
- // 5. Schedule a task to generate a key request, providing type, initData, and the new object.
+ // 5. Schedule a task to initialize the session, providing contentType, initData, and the new object.
session->generateKeyRequest(type, initData);
// 6. Return the new object to the caller.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes