<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>210456</bug_id>
          
          <creation_ts>2020-04-13 14:34:45 -0700</creation_ts>
          <short_desc>dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast&lt;&gt;()</short_desc>
          <delta_ts>2020-04-17 03:09:26 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=210448</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=210519</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>210646</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>aestes</cc>
    
    <cc>darin</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1641112</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-13 14:34:45 -0700</bug_when>
    <thetext>dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast&lt;&gt;(CFDictionaryGetValue()).

Currently dictionaryValueOfType() does this:

static CFTypeRef dictionaryValueOfType(CFDictionaryRef dictionary, CFStringRef key, CFTypeID type)
{
    CFTypeRef value = CFDictionaryGetValue(dictionary, key);
    if (value &amp;&amp; CFGetTypeID(value) == type)
        return value;
    return nullptr;
}

And dynamic_cf_cast&lt;&gt;() does the same thing, but also adds a Debug assertion when the CFTypeIDs don&apos;t match:

template&lt;typename T&gt; T dynamic_cf_cast(CFTypeRef object)
{
    if (!object)
        return nullptr;

    ASSERT_WITH_SECURITY_IMPLICATION(CFGetTypeID(object) == CFTypeTrait&lt;T&gt;::typeID());
    if (CFGetTypeID(object) != CFTypeTrait&lt;T&gt;::typeID())
        return nullptr;

    return static_cast&lt;T&gt;(const_cast&lt;CF_BRIDGED_TYPE(id) void*&gt;(object));
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641113</commentid>
    <comment_count>1</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-04-13 14:37:40 -0700</bug_when>
    <thetext>Those aren’t the same.

The dictionaryValueOfType is OK for use when we don’t know the type.

dynamic_cf_cast is only for use when do know the type.

Please don’t collapse them into one function. Feel free to change callers if they are using the wrong one.

Also, dynamic_cf_cast is named wrong. C++&apos;s dynamic_cast is OK when we don’t know the type, so this is more like checked_static_cf_cast.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641124</commentid>
    <comment_count>2</comment_count>
      <attachid>396337</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-13 14:52:08 -0700</bug_when>
    <thetext>Created attachment 396337
Patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641130</commentid>
    <comment_count>3</comment_count>
      <attachid>396337</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-04-13 15:06:48 -0700</bug_when>
    <thetext>Comment on attachment 396337
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396337&amp;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.

&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
&gt;      if (protocolProperties)
&gt; -        *protocolProperties = (CFDictionaryRef)dictionaryValueOfType(representation, CFSTR(&quot;protocolProperties&quot;), CFDictionaryGetTypeID());
&gt; +        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));

Should return false if the type is wrong.

&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:135
&gt;      if (expectedContentLength)
&gt; -        *expectedContentLength = (CFNumberRef)dictionaryValueOfType(representation, CFSTR(&quot;expectedContentLength&quot;), CFNumberGetTypeID());
&gt; +        *expectedContentLength = dynamic_cf_cast&lt;CFNumberRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;expectedContentLength&quot;)));

Ditto.

&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:138
&gt;      if (mimeType)
&gt; -        *mimeType = (CFStringRef)dictionaryValueOfType(representation, CFSTR(&quot;mimeType&quot;), CFStringGetTypeID());
&gt; +        *mimeType = dynamic_cf_cast&lt;CFStringRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;mimeType&quot;)));

Ditto.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641203</commentid>
    <comment_count>4</comment_count>
      <attachid>396337</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-13 18:12:53 -0700</bug_when>
    <thetext>Comment on attachment 396337
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396337&amp;action=review

&gt;&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
&gt;&gt; +        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt; 
&gt; Should return false if the type is wrong.

This is what I did to check if the type is wrong:

-    if (protocolProperties)
-        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
+    if (protocolProperties) {
+        *protocolProperties = nullptr;
+        if (auto value = CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;))) {
+            auto cfDictionary = dynamic_cf_cast&lt;CFDictionaryRef&gt;(value);
+            if (!cfDictionary)
+                return false;
+            *protocolProperties = cfDictionary;
+        }
+    }

I can&apos;t just check the output of dynamic_cf_cast&lt;&gt; because I can&apos;t distinguish between passing a nullptr in and passing an object of the wrong type in.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641230</commentid>
    <comment_count>5</comment_count>
      <attachid>396337</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-04-13 20:19:08 -0700</bug_when>
    <thetext>Comment on attachment 396337
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396337&amp;action=review

&gt;&gt;&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
&gt;&gt;&gt; +        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt;&gt; 
&gt;&gt; Should return false if the type is wrong.
&gt; 
&gt; This is what I did to check if the type is wrong:
&gt; 
&gt; -    if (protocolProperties)
&gt; -        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt; +    if (protocolProperties) {
&gt; +        *protocolProperties = nullptr;
&gt; +        if (auto value = CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;))) {
&gt; +            auto cfDictionary = dynamic_cf_cast&lt;CFDictionaryRef&gt;(value);
&gt; +            if (!cfDictionary)
&gt; +                return false;
&gt; +            *protocolProperties = cfDictionary;
&gt; +        }
&gt; +    }
&gt; 
&gt; I can&apos;t just check the output of dynamic_cf_cast&lt;&gt; because I can&apos;t distinguish between passing a nullptr in and passing an object of the wrong type in.

You should write a helper function since this is going to be done three times! And I think we should check the type even if the caller didn&apos;t ask us the fetch it.

    template&lt;typename ValueType&gt; bool extractDictionaryValue(CFString dictionary, CFStringRef key, ValueType* result)
    {
        auto untypedValue = CFDictionaryGetValue(dictionary, key);
        auto value = checked_cf_cast&lt;ValueType&gt;(untypedValue);
        if (untypedValue &amp;&amp; !value)
            return false;
        if (result)
            *result = value;
        return true;
    }

   ...

    if (!extractDictionaryValue(representation, CFSTR(&quot;protocolProperties&quot;), protocolProperties))
        return false;
    if (!extractDictionaryValue(representation, CFSTR(&quot;expectedContentLength&quot;), expectedContentLength))
        return false;
    if (!extractDictionaryValue(representation, CFSTR(&quot;mimeType&quot;), mimeType))
        return false;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641242</commentid>
    <comment_count>6</comment_count>
      <attachid>396337</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-13 21:04:25 -0700</bug_when>
    <thetext>Comment on attachment 396337
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396337&amp;action=review

&gt;&gt;&gt;&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
&gt;&gt;&gt;&gt; +        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt;&gt;&gt; 
&gt;&gt;&gt; Should return false if the type is wrong.
&gt;&gt; 
&gt;&gt; This is what I did to check if the type is wrong:
&gt;&gt; 
&gt;&gt; -    if (protocolProperties)
&gt;&gt; -        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt;&gt; +    if (protocolProperties) {
&gt;&gt; +        *protocolProperties = nullptr;
&gt;&gt; +        if (auto value = CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;))) {
&gt;&gt; +            auto cfDictionary = dynamic_cf_cast&lt;CFDictionaryRef&gt;(value);
&gt;&gt; +            if (!cfDictionary)
&gt;&gt; +                return false;
&gt;&gt; +            *protocolProperties = cfDictionary;
&gt;&gt; +        }
&gt;&gt; +    }
&gt;&gt; 
&gt;&gt; I can&apos;t just check the output of dynamic_cf_cast&lt;&gt; because I can&apos;t distinguish between passing a nullptr in and passing an object of the wrong type in.
&gt; 
&gt; You should write a helper function since this is going to be done three times! And I think we should check the type even if the caller didn&apos;t ask us the fetch it.
&gt; 
&gt;     template&lt;typename ValueType&gt; bool extractDictionaryValue(CFString dictionary, CFStringRef key, ValueType* result)
&gt;     {
&gt;         auto untypedValue = CFDictionaryGetValue(dictionary, key);
&gt;         auto value = checked_cf_cast&lt;ValueType&gt;(untypedValue);
&gt;         if (untypedValue &amp;&amp; !value)
&gt;             return false;
&gt;         if (result)
&gt;             *result = value;
&gt;         return true;
&gt;     }
&gt; 
&gt;    ...
&gt; 
&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;protocolProperties&quot;), protocolProperties))
&gt;         return false;
&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;expectedContentLength&quot;), expectedContentLength))
&gt;         return false;
&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;mimeType&quot;), mimeType))
&gt;         return false;

Note that checked_cf_cast&lt;&gt; crashes (release assert) if the type is wrong.  That would make for less code, but is that what you want here?

Is it okay to assume that protocolProperties, expectedContentLength and mimeType will always be set an never nullptr in the dictionary?  The old code didn&apos;t assume that.  Guess I could try to figure out where that comes from.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641405</commentid>
    <comment_count>7</comment_count>
      <attachid>396337</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-04-14 09:27:21 -0700</bug_when>
    <thetext>Comment on attachment 396337
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396337&amp;action=review

&gt;&gt;&gt;&gt;&gt; Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:132
&gt;&gt;&gt;&gt;&gt; +        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; Should return false if the type is wrong.
&gt;&gt;&gt; 
&gt;&gt;&gt; This is what I did to check if the type is wrong:
&gt;&gt;&gt; 
&gt;&gt;&gt; -    if (protocolProperties)
&gt;&gt;&gt; -        *protocolProperties = dynamic_cf_cast&lt;CFDictionaryRef&gt;(CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;)));
&gt;&gt;&gt; +    if (protocolProperties) {
&gt;&gt;&gt; +        *protocolProperties = nullptr;
&gt;&gt;&gt; +        if (auto value = CFDictionaryGetValue(representation, CFSTR(&quot;protocolProperties&quot;))) {
&gt;&gt;&gt; +            auto cfDictionary = dynamic_cf_cast&lt;CFDictionaryRef&gt;(value);
&gt;&gt;&gt; +            if (!cfDictionary)
&gt;&gt;&gt; +                return false;
&gt;&gt;&gt; +            *protocolProperties = cfDictionary;
&gt;&gt;&gt; +        }
&gt;&gt;&gt; +    }
&gt;&gt;&gt; 
&gt;&gt;&gt; I can&apos;t just check the output of dynamic_cf_cast&lt;&gt; because I can&apos;t distinguish between passing a nullptr in and passing an object of the wrong type in.
&gt;&gt; 
&gt;&gt; You should write a helper function since this is going to be done three times! And I think we should check the type even if the caller didn&apos;t ask us the fetch it.
&gt;&gt; 
&gt;&gt;     template&lt;typename ValueType&gt; bool extractDictionaryValue(CFString dictionary, CFStringRef key, ValueType* result)
&gt;&gt;     {
&gt;&gt;         auto untypedValue = CFDictionaryGetValue(dictionary, key);
&gt;&gt;         auto value = checked_cf_cast&lt;ValueType&gt;(untypedValue);
&gt;&gt;         if (untypedValue &amp;&amp; !value)
&gt;&gt;             return false;
&gt;&gt;         if (result)
&gt;&gt;             *result = value;
&gt;&gt;         return true;
&gt;&gt;     }
&gt;&gt; 
&gt;&gt;    ...
&gt;&gt; 
&gt;&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;protocolProperties&quot;), protocolProperties))
&gt;&gt;         return false;
&gt;&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;expectedContentLength&quot;), expectedContentLength))
&gt;&gt;         return false;
&gt;&gt;     if (!extractDictionaryValue(representation, CFSTR(&quot;mimeType&quot;), mimeType))
&gt;&gt;         return false;
&gt; 
&gt; Note that checked_cf_cast&lt;&gt; crashes (release assert) if the type is wrong.  That would make for less code, but is that what you want here?
&gt; 
&gt; Is it okay to assume that protocolProperties, expectedContentLength and mimeType will always be set an never nullptr in the dictionary?  The old code didn&apos;t assume that.  Guess I could try to figure out where that comes from.

No, I meant dynamic_cf_cast.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641637</commentid>
    <comment_count>8</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-14 18:24:43 -0700</bug_when>
    <thetext>Committed r260112: &lt;https://trac.webkit.org/changeset/260112&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641638</commentid>
    <comment_count>9</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-04-14 18:25:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/61800934&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>396337</attachid>
            <date>2020-04-13 14:52:08 -0700</date>
            <delta_ts>2020-04-13 15:06:48 -0700</delta_ts>
            <desc>Patch v1</desc>
            <filename>bug-210456-20200413145300.patch</filename>
            <type>text/plain</type>
            <size>4051</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjYwMDMwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZ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
</data>
<flag name="review"
          id="411755"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>