<?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>111253</bug_id>
          
          <creation_ts>2013-03-02 10:15:22 -0800</creation_ts>
          <short_desc>XSSAuditor has a subtle race condition when used with the threaded HTML parser</short_desc>
          <delta_ts>2013-03-02 18:46: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>New Bugs</component>
          <version>528+ (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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>106127</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Barth">abarth</reporter>
          <assigned_to name="Adam Barth">abarth</assigned_to>
          <cc>darin</cc>
    
    <cc>dbates</cc>
    
    <cc>dglazkov</cc>
    
    <cc>eric</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ojan.autocc</cc>
    
    <cc>philn</cc>
    
    <cc>tonyg</cc>
    
    <cc>webkit-ews</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>xan.lopez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>845817</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-02 10:15:22 -0800</bug_when>
    <thetext>XSSAuditor has a subtle race condition when used with the threaded HTML parser</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845819</commentid>
    <comment_count>1</comment_count>
      <attachid>191110</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-02 10:16:49 -0800</bug_when>
    <thetext>Created attachment 191110
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845820</commentid>
    <comment_count>2</comment_count>
      <attachid>191110</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-03-02 10:20:17 -0800</bug_when>
    <thetext>Comment on attachment 191110
Patch

Attachment 191110 did not pass chromium-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/16778921</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845822</commentid>
    <comment_count>3</comment_count>
      <attachid>191110</attachid>
    <who name="Early Warning System Bot">webkit-ews</who>
    <bug_when>2013-03-02 10:22:59 -0800</bug_when>
    <thetext>Comment on attachment 191110
Patch

Attachment 191110 did not pass qt-ews (qt):
Output: http://webkit-commit-queue.appspot.com/results/16844192</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845824</commentid>
    <comment_count>4</comment_count>
      <attachid>191110</attachid>
    <who name="EFL EWS Bot">eflews.bot</who>
    <bug_when>2013-03-02 10:23:32 -0800</bug_when>
    <thetext>Comment on attachment 191110
Patch

Attachment 191110 did not pass efl-ews (efl):
Output: http://webkit-commit-queue.appspot.com/results/16864160</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845826</commentid>
    <comment_count>5</comment_count>
      <attachid>191110</attachid>
    <who name="Early Warning System Bot">webkit-ews</who>
    <bug_when>2013-03-02 10:24:31 -0800</bug_when>
    <thetext>Comment on attachment 191110
Patch

Attachment 191110 did not pass qt-wk2-ews (qt):
Output: http://webkit-commit-queue.appspot.com/results/16864162</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845827</commentid>
    <comment_count>6</comment_count>
      <attachid>191110</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-03-02 10:25:15 -0800</bug_when>
    <thetext>Comment on attachment 191110
Patch

Attachment 191110 did not pass cr-linux-debug-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/16885074</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845829</commentid>
    <comment_count>7</comment_count>
      <attachid>191112</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-02 10:28:01 -0800</bug_when>
    <thetext>Created attachment 191112
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845850</commentid>
    <comment_count>8</comment_count>
      <attachid>191112</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-02 12:50:38 -0800</bug_when>
    <thetext>Comment on attachment 191112
Patch

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

&gt; Source/WebCore/html/parser/XSSAuditor.cpp:124
&gt; +    const String&amp; attrName = name.namespaceURI() == XLinkNames::xlinkNamespaceURI ? &quot;xlink:&quot; + name.localName().string() : name.localName().string();

The temporary string created by &quot;xlink:&quot; + name.localName().string() goes away at the end of this line. :)  This code will crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845871</commentid>
    <comment_count>9</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-02 14:00:26 -0800</bug_when>
    <thetext>If you bind a const reference to a temporary, then the temporary lives a long as the const ref.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845872</commentid>
    <comment_count>10</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-02 14:10:53 -0800</bug_when>
    <thetext>http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=199</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845874</commentid>
    <comment_count>11</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-02 14:21:28 -0800</bug_when>
    <thetext>(In reply to comment #9)
&gt; If you bind a const reference to a temporary, then the temporary lives a long as the const ref.

WAT!?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845875</commentid>
    <comment_count>12</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-02 14:21:44 -0800</bug_when>
    <thetext>C++ is even crazier than I thought.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845878</commentid>
    <comment_count>13</comment_count>
      <attachid>191112</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-02 15:22:37 -0800</bug_when>
    <thetext>Comment on attachment 191112
Patch

We should consider changing the names of thread safe functions like this one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845879</commentid>
    <comment_count>14</comment_count>
      <attachid>191112</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2013-03-02 15:24:11 -0800</bug_when>
    <thetext>Comment on attachment 191112
Patch

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

&gt;&gt; Source/WebCore/html/parser/XSSAuditor.cpp:124
&gt;&gt; +    const String&amp; attrName = name.namespaceURI() == XLinkNames::xlinkNamespaceURI ? &quot;xlink:&quot; + name.localName().string() : name.localName().string();
&gt; 
&gt; The temporary string created by &quot;xlink:&quot; + name.localName().string() goes away at the end of this line. :)  This code will crash.

From my understanding of the C++ standard, this code is correct by properties of a temporary object, 12.2/5 ([class.temporary]); initialization of a reference type, 8.5.3/5 ([dcl.init.ref]); the lifetime of a reference type, 3.7/3 ([basic.stc]); and the definition of automatic storage duration in 3.7.3/1 ([basic.stc.auto]).

For completeness the 11/02/2012 draft of the C++ standard (N3485) is at &lt;http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2012/n3485.pdf&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845888</commentid>
    <comment_count>15</comment_count>
      <attachid>191112</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-03-02 17:47:57 -0800</bug_when>
    <thetext>Comment on attachment 191112
Patch

Clearing flags on attachment: 191112

Committed r144549: &lt;http://trac.webkit.org/changeset/144549&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845889</commentid>
    <comment_count>16</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-03-02 17:48:01 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845898</commentid>
    <comment_count>17</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-03-02 18:46:13 -0800</bug_when>
    <thetext>(In reply to comment #11)
&gt; (In reply to comment #9)
&gt; &gt; If you bind a const reference to a temporary, then the temporary lives a long as the const ref.
&gt; 
&gt; WAT!?

Surprised me when I learned about it too.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>191110</attachid>
            <date>2013-03-02 10:16:49 -0800</date>
            <delta_ts>2013-03-02 10:27:58 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-111253-20130302101259.patch</filename>
            <type>text/plain</type>
            <size>1745</size>
            <attacher name="Adam Barth">abarth</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQ0NTQyCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOGQzMGIzMTRmZDhjMjI5
MDc3YjQyMzIzYzkzYzVkN2E2NjE1NjBjNC4uYTkxZGZjNjE4N2M5MTVlMzIyMjczOTgyMTAyZGQ4
MjFlZDQ5YWU1YiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE3IEBACisyMDEzLTAzLTAyICBBZGFt
IEJhcnRoICA8YWJhcnRoQHdlYmtpdC5vcmc+CisKKyAgICAgICAgWFNTQXVkaXRvciBoYXMgYSBz
dWJ0bGUgcmFjZSBjb25kaXRpb24gd2hlb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IuY3BwCisrKyBiL1NvdXJjZS9XZWJDb3JlL2h0bWwvcGFyc2VyL1hTU0F1
ZGl0b3IuY3BwCkBAIC0xMjAsNyArMTIwLDggQEAgc3RhdGljIGJvb2wgaGFzTmFtZShjb25zdCBI
VE1MVG9rZW4mIHRva2VuLCBjb25zdCBRdWFsaWZpZWROYW1lJiBuYW1lKQogCiBzdGF0aWMgYm9v
bCBmaW5kQXR0cmlidXRlV2l0aE5hbWUoY29uc3QgSFRNTFRva2VuJiB0b2tlbiwgY29uc3QgUXVh
bGlmaWVkTmFtZSYgbmFtZSwgc2l6ZV90JiBpbmRleE9mTWF0Y2hpbmdBdHRyaWJ1dGUpCiB7Ci0g
ICAgU3RyaW5nIGF0dHJOYW1lID0gbmFtZS5sb2NhbE5hbWUoKS5zdHJpbmcoKTsKKyAgICAvLyBO
b3RpY2UgdGhhdCB3ZSdyZSBjYXJlZnVsIG5vdCB0byByZWYgdGhlIFN0cmluZ0ltcGwgaGVyZSBi
ZWNhdXNlIHdlIG1pZ2h0IGJlIG9uIGEgYmFja2dyb3VuZCB0aHJlYWQuCisgICAgY29uc3QgU3Ry
aW5nJiBhdHRyTmFtZSA9IG5hbWUubG9jYWxOYW1lKCkuc3RyaW5nKCk7CiAKICAgICBpZiAobmFt
ZS5uYW1lc3BhY2VVUkkoKSA9PSBYTGlua05hbWVzOjp4bGlua05hbWVzcGFjZVVSSSkKICAgICAg
ICAgYXR0ck5hbWUgPSAieGxpbms6IiArIGF0dHJOYW1lOwo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>191112</attachid>
            <date>2013-03-02 10:28:01 -0800</date>
            <delta_ts>2013-03-02 17:47:57 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-111253-20130302102411.patch</filename>
            <type>text/plain</type>
            <size>1982</size>
            <attacher name="Adam Barth">abarth</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQ0NTQyCmR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