<?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>32850</bug_id>
          
          <creation_ts>2009-12-21 20:48:54 -0800</creation_ts>
          <short_desc>Allocate RemoteFontStream on the heap</short_desc>
          <delta_ts>2009-12-22 10:51:13 -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>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Kwang Yul Seo">skyul</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>agl</cc>
    
    <cc>commit-queue</cc>
    
    <cc>eric</cc>
    
    <cc>evan</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>174165</commentid>
    <comment_count>0</comment_count>
    <who name="Kwang Yul Seo">skyul</who>
    <bug_when>2009-12-21 20:48:54 -0800</bug_when>
    <thetext>In the chromium port of FontCustomPlatformData, an instance of RemoteFontStream is allocated on the stack, so its memory is freed immediately when FontCustomPlatformData::createFontCustomPlatformData returns. 

SkTypeface::CreateFromStream increments the reference count, but it keeps the pointer to the memory allocated on the stack which is not valid anymore.

RemoteFontStream is a descendant of SkRefCount and SkRefCount::unref invokes SkDELETE(this) internally once the reference count reaches zero. This means that SkRefCount-ed instances must be allocated on the heap.

It causes a crash in the acid3 test which loads web fonts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174166</commentid>
    <comment_count>1</comment_count>
      <attachid>45363</attachid>
    <who name="Kwang Yul Seo">skyul</who>
    <bug_when>2009-12-21 20:55:29 -0800</bug_when>
    <thetext>Created attachment 45363
Allocate RemoteFontStream on the heap

RemoteFontStream must be allocated on the heap.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174167</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2009-12-21 20:57:47 -0800</bug_when>
    <thetext>style-queue ran check-webkit-style on attachment 45363 without any errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174172</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-12-21 21:35:24 -0800</bug_when>
    <thetext>This would need review from one of the Chrome linux guys.  Once they OK it, I&apos;m happy to r+.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174303</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Langley">agl</who>
    <bug_when>2009-12-22 10:48:03 -0800</bug_when>
    <thetext>LGTM</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174306</commentid>
    <comment_count>5</comment_count>
      <attachid>45363</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-12-22 10:51:08 -0800</bug_when>
    <thetext>Comment on attachment 45363
Allocate RemoteFontStream on the heap

Clearing flags on attachment: 45363

Committed r52492: &lt;http://trac.webkit.org/changeset/52492&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174307</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-12-22 10:51:13 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>45363</attachid>
            <date>2009-12-21 20:55:29 -0800</date>
            <delta_ts>2009-12-22 10:51:08 -0800</delta_ts>
            <desc>Allocate RemoteFontStream on the heap</desc>
            <filename>RemoteFontStream.patch</filename>
            <type>text/plain</type>
            <size>1982</size>
            <attacher name="Kwang Yul Seo">skyul</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1MjQ3OCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMjUgQEAKKzIwMDktMTItMjEgIEt3YW5nIFl1bCBTZW8gIDxza3l1bEBjb21wYW55
MTAwLm5ldD4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAg
ICBBbGxvY2F0ZSBSZW1vdGVGb250U3RyZWFtIG9uIHRoZSBoZWFwCisgICAgICAgIGh0dHBzOi8v
YnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0zMjg1MAorCisgICAgICAgIFJlbW90ZUZv
bnRTdHJlYW0gaXMgYWxsb2NhdGVkIG9uIHRoZSBzdGFjaywgc28gaXRzIG1lbW9yeSBpcyBmcmVl
ZAorICAgICAgICBpbW1lZGlhdGVseSB3aGVuIEZvbnRDdXN0b21QbGF0Zm9ybURhdGE6OmNyZWF0
ZUZvbnRDdXN0b21QbGF0Zm9ybURhdGEKKyAgICAgICAgcmV0dXJucy4gCisKKyAgICAgICAgU2tU
eXBlZmFjZTo6Q3JlYXRlRnJvbVN0cmVhbSBpbmNyZW1lbnRzIHRoZSByZWZlcmVuY2UgY291bnQs
IGJ1dCBpdCBrZWVwcworICAgICAgICB0aGUgcG9pbnRlciB0byB0aGUgbWVtb3J5IGFs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