<?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>160850</bug_id>
          
          <creation_ts>2016-08-15 07:35:42 -0700</creation_ts>
          <short_desc>[Win] Hardening of getLinkedFonts function.</short_desc>
          <delta_ts>2016-08-16 02:48:56 -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>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Per Arne Vollan">pvollan</reporter>
          <assigned_to name="Per Arne Vollan">pvollan</assigned_to>
          <cc>achristensen</cc>
    
    <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1220021</commentid>
    <comment_count>0</comment_count>
    <who name="Per Arne Vollan">pvollan</who>
    <bug_when>2016-08-15 07:35:42 -0700</bug_when>
    <thetext>The SUCCEEDED macro should only be used for functions returning a HRESULT type.
Also, make sure a string array index will not exceed the string length.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220022</commentid>
    <comment_count>1</comment_count>
      <attachid>286053</attachid>
    <who name="Per Arne Vollan">pvollan</who>
    <bug_when>2016-08-15 08:03:05 -0700</bug_when>
    <thetext>Created attachment 286053
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220028</commentid>
    <comment_count>2</comment_count>
      <attachid>286053</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2016-08-15 08:43:02 -0700</bug_when>
    <thetext>Comment on attachment 286053
Patch

Interesting! I didn&apos;t know that SUCCEEDED was inappropriate here. Are there return values from RegQueryValueEx that might fool SUCCEEDED?

It also makes me wonder if we should be using the FAILED macro a few lines above this one, since it also returns a LONG instead of an HRESULT.

I also wonder if we should call &quot;family.charactersWithNullTermination().data()&quot; so many times -- I think (but didn&apos;t look) that it creates a new string each time we call that.

r=me! :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220042</commentid>
    <comment_count>3</comment_count>
    <who name="Per Arne Vollan">pvollan</who>
    <bug_when>2016-08-15 09:39:20 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 286053 [details]
&gt; Patch

Thanks for reviewing :-)

&gt; 
&gt; Interesting! I didn&apos;t know that SUCCEEDED was inappropriate here. Are there
&gt; return values from RegQueryValueEx that might fool SUCCEEDED?
&gt; 

Yes I believe there are.

&gt; It also makes me wonder if we should be using the FAILED macro a few lines
&gt; above this one, since it also returns a LONG instead of an HRESULT.
&gt; 
&gt; I also wonder if we should call
&gt; &quot;family.charactersWithNullTermination().data()&quot; so many times -- I think
&gt; (but didn&apos;t look) that it creates a new string each time we call that.
&gt; 

Yes I believe you&apos;re right. I can look into that :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220044</commentid>
    <comment_count>4</comment_count>
    <who name="Per Arne Vollan">pvollan</who>
    <bug_when>2016-08-15 09:41:22 -0700</bug_when>
    <thetext>rdar://problem/17471209</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220049</commentid>
    <comment_count>5</comment_count>
      <attachid>286053</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-08-15 09:45:52 -0700</bug_when>
    <thetext>Comment on attachment 286053
Patch

Rejecting attachment 286053 from commit-queue.

Failed to run &quot;[&apos;/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch&apos;, &apos;--status-host=webkit-queues.webkit.org&apos;, &apos;--bot-id=webkit-cq-01&apos;, &apos;validate-changelog&apos;, &apos;--check-oops&apos;, &apos;--non-interactive&apos;, 286053, &apos;--port=mac&apos;]&quot; exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

/Volumes/Data/EWS/WebKit/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string &quot;Unreviewed&quot; or &quot;Rubber stamp&quot; (case insensitive).

Full output: http://webkit-queues.webkit.org/results/1875986</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220145</commentid>
    <comment_count>6</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2016-08-15 13:58:18 -0700</bug_when>
    <thetext>Please write a test for the comma change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1220424</commentid>
    <comment_count>7</comment_count>
    <who name="Per Arne Vollan">pvollan</who>
    <bug_when>2016-08-16 02:48:56 -0700</bug_when>
    <thetext>Committed r204502: &lt;https://trac.webkit.org/changeset/204502&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>286053</attachid>
            <date>2016-08-15 08:03:05 -0700</date>
            <delta_ts>2016-08-15 09:45:52 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-160850-20160815080124.patch</filename>
            <type>text/plain</type>
            <size>1967</size>
            <attacher name="Per Arne Vollan">pvollan</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uID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ICAgICAgaSsrOwor
ICAgICAgICAgICAgLy8gQnJlYWsgaWYgd2UgZGlkIG5vdCBmaW5kIGEgY29tbWEuCisgICAgICAg
ICAgICBpZiAoaSA9PSBsZW5ndGgpCisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAg
ICBpKys7CiAgICAgICAgICAgICB1bnNpZ25lZCBqID0gaTsKICAgICAgICAgICAgIHdoaWxlIChq
IDwgbGVuZ3RoICYmIGxpbmtlZEZvbnRzW2pdKQo=
</data>
<flag name="review"
          id="309621"
          type_id="1"
          status="+"
          setter="bfulgham"
    />
    <flag name="commit-queue"
          id="309628"
          type_id="3"
          status="-"
          setter="commit-queue"
    />
          </attachment>
      

    </bug>

</bugzilla>