⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284789 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 10:25:55 AM (5 years ago)
Author:
Darin Adler
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r284782 r284789  
     12021-10-25  Darin Adler  <darin@apple.com>
     2
     3        Restore strict parsing behavior in parseStringArrayFromDictionaryToUInt16Vector
     4        https://bugs.webkit.org/show_bug.cgi?id=232218
     5
     6        Reviewed by Sam Weinig.
     7
     8        * platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
     9        (WebCore::parseStringArrayFromDictionaryToUInt16Vector): Make sure the entire parse
     10        fails if any of the elements in the array are either not strings, or do not parse
     11        successfully as a uint16_t.
     12
    1132021-10-25  Alan Bujtas  <zalan@apple.com>
    214
  • trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm

    r284763 r284789  
    142142    if (!array)
    143143        return std::nullopt;
    144     return makeVector(bridge_cast(array), [] (id value) {
    145         return parseInteger<uint16_t>(String(dynamic_objc_cast<NSString>(value)));
     144    bool parseFailed = false;
     145    auto result = makeVector(bridge_cast(array), [&] (id value) {
     146        auto parseResult = parseInteger<uint16_t>(String(dynamic_objc_cast<NSString>(value)));
     147        parseFailed |= !parseResult;
     148        return parseResult;
    146149    });
     150    if (parseFailed)
     151        return std::nullopt;
     152    return result;
    147153}
    148154
Note: See TracChangeset for help on using the changeset viewer.