Title: [284789] trunk/Source/WebCore
Revision
284789
Author
[email protected]
Date
2021-10-25 10:25:55 -0700 (Mon, 25 Oct 2021)

Log Message

Restore strict parsing behavior in parseStringArrayFromDictionaryToUInt16Vector
https://bugs.webkit.org/show_bug.cgi?id=232218

Reviewed by Sam Weinig.

* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::parseStringArrayFromDictionaryToUInt16Vector): Make sure the entire parse
fails if any of the elements in the array are either not strings, or do not parse
successfully as a uint16_t.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (284788 => 284789)


--- trunk/Source/WebCore/ChangeLog	2021-10-25 17:02:25 UTC (rev 284788)
+++ trunk/Source/WebCore/ChangeLog	2021-10-25 17:25:55 UTC (rev 284789)
@@ -1,3 +1,15 @@
+2021-10-25  Darin Adler  <[email protected]>
+
+        Restore strict parsing behavior in parseStringArrayFromDictionaryToUInt16Vector
+        https://bugs.webkit.org/show_bug.cgi?id=232218
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
+        (WebCore::parseStringArrayFromDictionaryToUInt16Vector): Make sure the entire parse
+        fails if any of the elements in the array are either not strings, or do not parse
+        successfully as a uint16_t.
+
 2021-10-25  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Check across inline box boundaries for breakable position

Modified: trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm (284788 => 284789)


--- trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm	2021-10-25 17:02:25 UTC (rev 284788)
+++ trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm	2021-10-25 17:25:55 UTC (rev 284789)
@@ -141,9 +141,15 @@
     auto array = dynamic_cf_cast<CFArrayRef>(CFDictionaryGetValue(dictionary, key));
     if (!array)
         return std::nullopt;
-    return makeVector(bridge_cast(array), [] (id value) {
-        return parseInteger<uint16_t>(String(dynamic_objc_cast<NSString>(value)));
+    bool parseFailed = false;
+    auto result = makeVector(bridge_cast(array), [&] (id value) {
+        auto parseResult = parseInteger<uint16_t>(String(dynamic_objc_cast<NSString>(value)));
+        parseFailed |= !parseResult;
+        return parseResult;
     });
+    if (parseFailed)
+        return std::nullopt;
+    return result;
 }
 
 std::optional<MediaCapabilitiesInfo> validateDoViParameters(const DoViParameters& parameters, bool hasAlphaChannel, bool hdrSupport)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to