<?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>73849</bug_id>
          
          <creation_ts>2011-12-05 11:29:47 -0800</creation_ts>
          <short_desc>In FontCacheAndroid.cpp should keep the pointer valid returned from CString::data()</short_desc>
          <delta_ts>2011-12-07 11:22:07 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Android</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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>73672</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Xianzhu Wang">wangxianzhu</reporter>
          <assigned_to name="Xianzhu Wang">wangxianzhu</assigned_to>
          <cc>abarth</cc>
    
    <cc>cc-bugs</cc>
    
    <cc>jamesr</cc>
    
    <cc>peter</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>515243</commentid>
    <comment_count>0</comment_count>
    <who name="Xianzhu Wang">wangxianzhu</who>
    <bug_when>2011-12-05 11:29:47 -0800</bug_when>
    <thetext>In FontCacheAndroid.cpp, name will be invalid after the following piece of code if name is got from String::utf8().data(), because the temporary CString returned from String::utf8() has been destructed after that statement.

FontPlatformData* FontCache::createFontPlatformData(const FontDescription&amp; fontDescription, const AtomicString&amp; family)
{
    const char* name = 0;

    // If a fallback font is being created (e.g. &quot;-webkit-monospace&quot;), convert
    // it in to the fallback name (e.g. &quot;monospace&quot;).
    if (!family.length() || family.startsWith(&quot;-webkit-&quot;))
        name = getFallbackFontName(fontDescription);
    else
        name = family.string().utf8().data();</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515245</commentid>
    <comment_count>1</comment_count>
      <attachid>117908</attachid>
    <who name="Xianzhu Wang">wangxianzhu</who>
    <bug_when>2011-12-05 11:35:49 -0800</bug_when>
    <thetext>Created attachment 117908
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515274</commentid>
    <comment_count>2</comment_count>
      <attachid>117908</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-12-05 12:18:09 -0800</bug_when>
    <thetext>Comment on attachment 117908
patch

Is this code testable in any way?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515340</commentid>
    <comment_count>3</comment_count>
      <attachid>117908</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-12-05 13:17:51 -0800</bug_when>
    <thetext>Comment on attachment 117908
patch

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

I agree with James that this should be testable.  Is this covered by an existing LayoutTests on Android?

&gt; Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp:150
&gt; +    CString nameString; // Keeps name valid within scope of this function in case that name is got from family.

I&apos;m not sure &quot;got&quot; is grammatically correct in this comment.  Maybe remplace &quot;got from family&quot; with &quot;from a family&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515836</commentid>
    <comment_count>4</comment_count>
    <who name="Peter Beverloo">peter</who>
    <bug_when>2011-12-06 05:39:50 -0800</bug_when>
    <thetext>Thank you!
This change lgtm and actually is how it&apos;s being used downstream. The nameString variable got lost in a clean-up, for which I&apos;m to blame.

In order to properly run tests we need to be able to link and run, but as of this morning there still are ~30 unique linking errors present. Downstream the code is being tested using regular layout tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515985</commentid>
    <comment_count>5</comment_count>
      <attachid>117908</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-12-06 09:55:50 -0800</bug_when>
    <thetext>Comment on attachment 117908
patch

I&apos;m not as concerned about whether the tests are currently being run upstream but rather whether we will have test coverage for this change when we do start running tests.  If I understood you correctly, you&apos;re saying that we will.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516582</commentid>
    <comment_count>6</comment_count>
    <who name="Peter Beverloo">peter</who>
    <bug_when>2011-12-07 03:45:42 -0800</bug_when>
    <thetext>Indeed, the font cache will be exercised by most layout tests as it&apos;s used in the CSS Font Selector. Xianzhu Wang, do we have any layout tests specifically testing the fallback behavior?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516731</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-12-07 10:37:37 -0800</bug_when>
    <thetext>Ok.  Looks like we just need to fix the typo in the comment and we&apos;re ready to land.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516744</commentid>
    <comment_count>8</comment_count>
      <attachid>118231</attachid>
    <who name="Xianzhu Wang">wangxianzhu</who>
    <bug_when>2011-12-07 10:51:40 -0800</bug_when>
    <thetext>Created attachment 118231
updated patch

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

&gt;&gt; Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp:150
&gt;&gt; +    CString nameString; // Keeps name valid within scope of this function in case that name is got from family.
&gt; 
&gt; I&apos;m not sure &quot;got&quot; is grammatically correct in this comment.  Maybe remplace &quot;got from family&quot; with &quot;from a family&quot;?

Done.

(In reply to comment #6)
&gt; Indeed, the font cache will be exercised by most layout tests as it&apos;s used in the CSS Font Selector. Xianzhu Wang, do we have any layout tests specifically testing the fallback behavior?

I&apos;ve that the changed code has already been covered by existing layout tests.

I&apos;m running layout tests to see if the fallback behavior is covered. If not, will file another bug for adding a layout test for it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516759</commentid>
    <comment_count>9</comment_count>
    <who name="Xianzhu Wang">wangxianzhu</who>
    <bug_when>2011-12-07 11:06:28 -0800</bug_when>
    <thetext>Verified that the fallback behavior is also covered by at least fast/css/font-family-pictograph.html.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516762</commentid>
    <comment_count>10</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-12-07 11:09:08 -0800</bug_when>
    <thetext>Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516771</commentid>
    <comment_count>11</comment_count>
      <attachid>118231</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-12-07 11:22:02 -0800</bug_when>
    <thetext>Comment on attachment 118231
updated patch

Clearing flags on attachment: 118231

Committed r102255: &lt;http://trac.webkit.org/changeset/102255&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516772</commentid>
    <comment_count>12</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-12-07 11:22:07 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>117908</attachid>
            <date>2011-12-05 11:35:49 -0800</date>
            <delta_ts>2011-12-07 10:51:40 -0800</delta_ts>
            <desc>patch</desc>
            <filename>73849</filename>
            <type>text/plain</type>
            <size>1840</size>
            <attacher name="Xianzhu Wang">wangxianzhu</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwMjAyMikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEB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CkgPj0g
Rm9udFdlaWdodEJvbGQpCg==
</data>
<flag name="review"
          id="117506"
          type_id="1"
          status="+"
          setter="abarth"
    />
    <flag name="commit-queue"
          id="117507"
          type_id="3"
          status="-"
          setter="abarth"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>118231</attachid>
            <date>2011-12-07 10:51:40 -0800</date>
            <delta_ts>2011-12-07 11:22:02 -0800</delta_ts>
            <desc>updated patch</desc>
            <filename>73849a</filename>
            <type>text/plain</type>
            <size>1910</size>
            <attacher name="Xianzhu Wang">wangxianzhu</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwMjAyMikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE1IEBACisyMDExLTEyLTA1ICBYaWFuemh1
IFdhbmcgIDx3YW5neGlhbnpodUBjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgSW4gRm9udENhY2hl
QW5kcm9pZC5jcHAgc2hvdWxkIGtlZXAgdGhlIHBvaW50ZXIgdmFsaWQgcmV0dXJuZWQgZnJvbSBD
U3RyaW5nOjpkYXRhKCkKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcu
Y2dpP2lkPTczODQ5CisKKyAgICAgICAgVGhlIGNoYW5nZWQgY29kZSBoYXMgYmVlbiBjb3ZlcmVk
IGJ5IG1hbnkgZXhpc3RpbmcgbGF5b3V0IHRlc3RzLgorCisgICAgICAgIFJldmlld2VkIGJ5IEFk
YW0gQmFydGguCisKKyAgICAgICAgKiBwbGF0Zm9ybS9ncmFwaGljcy9ja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mdW5j
dGlvbiBpbiBjYXNlIHRoYXQgbmFtZSBpcyBmcm9tIGEgZmFtaWx5LgogCiAgICAgLy8gSWYgYSBm
YWxsYmFjayBmb250IGlzIGJlaW5nIGNyZWF0ZWQgKGUuZy4gIi13ZWJraXQtbW9ub3NwYWNlIiks
IGNvbnZlcnQKICAgICAvLyBpdCBpbiB0byB0aGUgZmFsbGJhY2sgbmFtZSAoZS5nLiAibW9ub3Nw
YWNlIikuCiAgICAgaWYgKCFmYW1pbHkubGVuZ3RoKCkgfHwgZmFtaWx5LnN0YXJ0c1dpdGgoIi13
ZWJraXQtIikpCiAgICAgICAgIG5hbWUgPSBnZXRGYWxsYmFja0ZvbnROYW1lKGZvbnREZXNjcmlw
dGlvbik7Ci0gICAgZWxzZQotICAgICAgICBuYW1lID0gZmFtaWx5LnN0cmluZygpLnV0ZjgoKS5k
YXRhKCk7CisgICAgZWxzZSB7CisgICAgICAgIG5hbWVTdHJpbmcgPSBmYW1pbHkuc3RyaW5nKCku
dXRmOCgpOworICAgICAgICBuYW1lID0gbmFtZVN0cmluZy5kYXRhKCk7CisgICAgfQogCiAgICAg
aW50IHN0eWxlID0gU2tUeXBlZmFjZTo6a05vcm1hbDsKICAgICBpZiAoZm9udERlc2NyaXB0aW9u
LndlaWdodCgpID49IEZvbnRXZWlnaHRCb2xkKQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>