[EME] Build failure with Clang-3.8 on InitDataRegistry.cpp
authorclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jul 2017 17:27:10 +0000 (17:27 +0000)
committerclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jul 2017 17:27:10 +0000 (17:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174628

Reviewed by Žan Doberšek.

* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids): Add an explicit cast to unsigned.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219658 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp

index ff80ad9fa05d6a999a0286c77f8f7786aafe299a..2b872e8675e9912d3a013d953e3fdf800ae4ba66 100644 (file)
@@ -1,3 +1,13 @@
+2017-07-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
+
+        [EME] Build failure with Clang-3.8 on InitDataRegistry.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=174628
+
+        Reviewed by Žan Doberšek.
+
+        * Modules/encryptedmedia/InitDataRegistry.cpp:
+        (WebCore::extractKeyIDsKeyids): Add an explicit cast to unsigned.
+
 2017-07-19  Matt Lewis  <jlewis3@apple.com>
 
         Unreviewed, rolling out r219646.
index 07e38193f6e34e19f4b2a3a63650623a1cba9554..5e97036cdc131810334032df2db7ff10f4093975 100644 (file)
@@ -42,7 +42,9 @@ static Vector<Ref<SharedBuffer>> extractKeyIDsKeyids(const SharedBuffer& buffer)
 {
     // 1. Format
     // https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format
-    String json { buffer.data(), buffer.size() };
+    if (buffer.size() > std::numeric_limits<unsigned>::max())
+        return { };
+    String json { buffer.data(), static_cast<unsigned>(buffer.size()) };
 
     RefPtr<InspectorValue> value;
     if (!InspectorValue::parseJSON(json, value))