[webkit-reviews] review granted: [Bug 210456] dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast<>() : [Attachment 396337] Patch v1
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Apr 13 15:06:48 PDT 2020
Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 210456: dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be
replaced with dynamic_cf_cast<>()
https://bugs.webkit.org/show_bug.cgi?id=210456
Attachment 396337: Patch v1
https://bugs.webkit.org/attachment.cgi?id=396337&action=review
--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 396337
--> https://bugs.webkit.org/attachment.cgi?id=396337
Patch v1
View in context: https://bugs.webkit.org/attachment.cgi?id=396337&action=review
All of these are cases where it’s OK to assert, because it’s more of a security
check, not a real possibility of the wrong type outside a security problem.
> Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
> if (protocolProperties)
> - *protocolProperties =
(CFDictionaryRef)dictionaryValueOfType(representation,
CFSTR("protocolProperties"), CFDictionaryGetTypeID());
> + *protocolProperties =
dynamic_cf_cast<CFDictionaryRef>(CFDictionaryGetValue(representation,
CFSTR("protocolProperties")));
Should return false if the type is wrong.
> Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:135
> if (expectedContentLength)
> - *expectedContentLength =
(CFNumberRef)dictionaryValueOfType(representation,
CFSTR("expectedContentLength"), CFNumberGetTypeID());
> + *expectedContentLength =
dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(representation,
CFSTR("expectedContentLength")));
Ditto.
> Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:138
> if (mimeType)
> - *mimeType = (CFStringRef)dictionaryValueOfType(representation,
CFSTR("mimeType"), CFStringGetTypeID());
> + *mimeType =
dynamic_cf_cast<CFStringRef>(CFDictionaryGetValue(representation,
CFSTR("mimeType")));
Ditto.
More information about the webkit-reviews
mailing list