Title: [220723] trunk/Source/WebCore
- Revision
- 220723
- Author
- jer.no...@apple.com
- Date
- 2017-08-14 16:33:27 -0700 (Mon, 14 Aug 2017)
Log Message
Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
https://bugs.webkit.org/show_bug.cgi?id=175547
Reviewed by Eric Carlson.
When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
proof-of-key-release data.
Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
Browsing mode, to match the behavior of WebKitMediaKeySession.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::releaseKeys):
(WebCore::CDMSessionAVStreamSession::update):
(WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (220722 => 220723)
--- trunk/Source/WebCore/ChangeLog 2017-08-14 23:21:03 UTC (rev 220722)
+++ trunk/Source/WebCore/ChangeLog 2017-08-14 23:33:27 UTC (rev 220723)
@@ -1,3 +1,23 @@
+2017-08-14 Jer Noble <jer.no...@apple.com>
+
+ Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=175547
+
+ Reviewed by Eric Carlson.
+
+ When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
+ proof-of-key-release data.
+
+ Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
+ Browsing mode, to match the behavior of WebKitMediaKeySession.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
+ * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
+ (WebCore::CDMSessionAVStreamSession::releaseKeys):
+ (WebCore::CDMSessionAVStreamSession::update):
+ (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
+
2017-08-14 Andy Estes <aes...@apple.com>
REGRESSION (r220456): Crash in PreviewLoader::shouldCreateForMIMEType() when a ResourceResponse has a null MIME type
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (220722 => 220723)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-08-14 23:21:03 UTC (rev 220722)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-08-14 23:33:27 UTC (rev 220723)
@@ -2516,6 +2516,10 @@
String HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() const
{
+ auto* page = document().page();
+ if (!page || page->usesEphemeralSession())
+ return emptyString();
+
String storageDirectory = document().settings().mediaKeysStorageDirectory();
if (storageDirectory.isEmpty())
return emptyString();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm (220722 => 220723)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm 2017-08-14 23:21:03 UTC (rev 220722)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm 2017-08-14 23:33:27 UTC (rev 220723)
@@ -142,11 +142,12 @@
if (!m_certificate)
return;
- if (![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)])
+ String storagePath = this->storagePath();
+ if (storagePath.isEmpty() || ![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)])
return;
RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
- NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
for (NSData* expiredSessionData in expiredSessions) {
NSDictionary *expiredSession = [NSPropertyListSerialization propertyListWithData:expiredSessionData options:kCFPropertyListImmutable format:nullptr error:nullptr];
NSString *playbackSessionIdValue = (NSString *)[expiredSession objectForKey:PlaybackSessionIdKey];
@@ -200,8 +201,9 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-literal-conversion"
- if ([getAVStreamSessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
- [getAVStreamSessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ String storagePath = this->storagePath();
+ if (!storagePath.isEmpty() && [getAVStreamSessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
+ [getAVStreamSessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
#pragma clang diagnostic pop
m_expiredSession = nullptr;
return true;
@@ -316,13 +318,14 @@
m_certificate = m_initData;
RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
- if (![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
+ String storagePath = this->storagePath();
+ if (storagePath.isEmpty() || ![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
errorCode = MediaPlayer::KeySystemNotSupported;
systemCode = '!mor';
return nullptr;
}
- NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
if (![expiredSessions count]) {
LOG(Media, "CDMSessionAVStreamSession::generateKeyReleaseMessage(%p) - no expired sessions found", this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes