Changeset 236256 in webkit
- Timestamp:
- Sep 20, 2018, 4:22:00 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Modules/encryptedmedia/InitDataRegistry.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236255 r236256 1 2018-09-20 Yacine Bandou <yacine.bandou@softathome.com> 2 3 [EME] Add WebM sanitization 4 https://bugs.webkit.org/show_bug.cgi?id=189740 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 This patch adds support for sanitizing the WebM initialization data, 9 ensures there are no bogus values. 10 See https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-generaterequest. 11 12 Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-generate-request-disallowed-input.https.html 13 14 * Modules/encryptedmedia/InitDataRegistry.cpp: 15 (WebCore::sanitizeWebM): Added implementation, check if the initialization data doesn't empty and its size 16 should be less than 64KB, return the buffer copy if it is ok, otherwise a nullptr. 17 (WebCore::extractKeyIDsWebM): Added implementation. 18 1 19 2018-09-20 Philippe Normand <pnormand@igalia.com> 2 20 -
trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp
r234689 r236256 42 42 namespace { 43 43 const uint32_t kCencMaxBoxSize = 64 * KB; 44 // ContentEncKeyID has this EBML code [47][E2] in WebM, 45 // as per spec the size of the ContentEncKeyID is encoded on 16 bits. 46 // https://matroska.org/technical/specs/index.html#ContentEncKeyID/ 47 const uint32_t kWebMMaxContentEncKeyIDSize = 64 * KB; // 2^16 44 48 } 45 49 … … 140 144 static RefPtr<SharedBuffer> sanitizeWebM(const SharedBuffer& buffer) 141 145 { 146 // Check if the buffer is a valid WebM initData. 147 // The WebM initData is the ContentEncKeyID, so should be less than kWebMMaxContentEncKeyIDSize. 148 if (buffer.isEmpty() || buffer.size() > kWebMMaxContentEncKeyIDSize) 149 return nullptr; 150 151 return buffer.copy(); 152 } 153 154 static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsWebM(const SharedBuffer& buffer) 155 { 156 Vector<Ref<SharedBuffer>> keyIDs; 157 RefPtr<SharedBuffer> sanitazedBuffer = sanitizeWebM(buffer); 158 if (!sanitazedBuffer) 159 return std::nullopt; 160 142 161 // 1. Format 143 162 // https://w3c.github.io/encrypted-media/format-registry/initdata/webm.html#format 144 notImplemented(); 145 return buffer.copy(); 146 } 147 148 static std::optional<Vector<Ref<SharedBuffer>>> extractKeyIDsWebM(const SharedBuffer&) 149 { 150 // 1. Format 151 // https://w3c.github.io/encrypted-media/format-registry/initdata/webm.html#format 152 notImplemented(); 153 return std::nullopt; 163 keyIDs.append(sanitazedBuffer.releaseNonNull()); 164 return keyIDs; 154 165 } 155 166
Note:
See TracChangeset
for help on using the changeset viewer.