<?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>161739</bug_id>
          
          <creation_ts>2016-09-08 08:13:05 -0700</creation_ts>
          <short_desc>[css-grid] Fix a dangling reference</short_desc>
          <delta_ts>2016-09-15 09:34:27 -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>New Bugs</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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sergio Villar Senin">svillar</reporter>
          <assigned_to name="Sergio Villar Senin">svillar</assigned_to>
          <cc>ap</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>glenn</cc>
    
    <cc>jfernandez</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>rego</cc>
    
    <cc>svillar</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1227598</commentid>
    <comment_count>0</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2016-09-08 08:13:05 -0700</bug_when>
    <thetext>[css-grid] Fix a dangling reference</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227599</commentid>
    <comment_count>1</comment_count>
      <attachid>288268</attachid>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2016-09-08 08:16:12 -0700</bug_when>
    <thetext>Created attachment 288268
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227600</commentid>
    <comment_count>2</comment_count>
      <attachid>288268</attachid>
    <who name="Manuel Rego Casasnovas">rego</who>
    <bug_when>2016-09-08 08:26:17 -0700</bug_when>
    <thetext>Comment on attachment 288268
Patch

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

r=me

&gt; Source/WebCore/rendering/RenderGrid.cpp:2009
&gt; +        GridLength maxTrackSize = gridTrackSize(ForRows, trackPosition, sizingOperation).maxTrackBreadth();

Nit: You could even use &quot;auto&quot; instead of &quot;GridLength&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1228006</commentid>
    <comment_count>3</comment_count>
      <attachid>288268</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-08 19:37:42 -0700</bug_when>
    <thetext>Comment on attachment 288268
Patch

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

&gt; Source/WebCore/ChangeLog:9
&gt; +        The code was trying to get a reference to a private attribute of a temporary object returned
&gt; +        by gridTrackSize().

What symptom did you observe?

This code is correct in C++ - a const reference extends lifetime of a temporary. Also, this pattern is repeated multiple times in this file, so if this were a problem, it would need to be addressed in more than this single spot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1228007</commentid>
    <comment_count>4</comment_count>
      <attachid>288268</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-08 19:39:35 -0700</bug_when>
    <thetext>Comment on attachment 288268
Patch

Looking again, I misread the code. This does have a problem.

Looks like we need a test that would catch it under ASan.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229154</commentid>
    <comment_count>5</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2016-09-13 06:34:16 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Comment on attachment 288268 [details]
&gt; Patch
&gt; 
&gt; Looking again, I misread the code. This does have a problem.
&gt; 
&gt; Looks like we need a test that would catch it under ASan.

Correct me if I&apos;m wrong but the ASan build is only currently available for the Mac port?

I don&apos;t currently have access to a Mac setup. Perhaps we could land this now and a test later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229183</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-13 09:46:46 -0700</bug_when>
    <thetext>I would expect any test that executes this code path to crash under ASan, so my guess is that this code is not covered by any tests. If you have a test that executes this code, I can run it under ASan to confirm that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229487</commentid>
    <comment_count>7</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2016-09-14 01:32:20 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; I would expect any test that executes this code path to crash under ASan, so
&gt; my guess is that this code is not covered by any tests. If you have a test
&gt; that executes this code, I can run it under ASan to confirm that.

So basically most of our tests with orthogonal flows go through that code path you could test it with:

fast/css-grid-layout/grid-item-positioning-with-orthogonal-flows.html
fast/css-grid-layout/grid-item-sizing-with-orthogonal-flows.html
fast/css-grid-layout/grid-item-spanning-and-orthogonal-flows.html
fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229836</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-14 17:10:36 -0700</bug_when>
    <thetext>fast/css-grid-layout/grid-item-positioning-with-orthogonal-flows.html doesn&apos;t crash with ASan enabled on Mac. I haven&apos;t yet had the chance to check whether the code path is being hit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229907</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-14 22:40:04 -0700</bug_when>
    <thetext>This code is indeed executed, and looks like ASan doesn&apos;t currently detect this error. In trunk clang, that can be enabled separately with -fsanitize-address-use-after-scope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229925</commentid>
    <comment_count>10</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2016-09-15 00:38:44 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; This code is indeed executed, and looks like ASan doesn&apos;t currently detect
&gt; this error. In trunk clang, that can be enabled separately with
&gt; -fsanitize-address-use-after-scope.

Weird.

In any case, provided the fix is correct I guess we can safely land this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1230021</commentid>
    <comment_count>11</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-09-15 09:06:53 -0700</bug_when>
    <thetext>Yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1230027</commentid>
    <comment_count>12</comment_count>
      <attachid>288268</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-09-15 09:34:23 -0700</bug_when>
    <thetext>Comment on attachment 288268
Patch

Clearing flags on attachment: 288268

Committed r205973: &lt;http://trac.webkit.org/changeset/205973&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1230028</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-09-15 09:34:27 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>288268</attachid>
            <date>2016-09-08 08:16:12 -0700</date>
            <delta_ts>2016-09-15 09:34:23 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-161739-20160908171247.patch</filename>
            <type>text/plain</type>
            <size>1758</size>
            <attacher name="Sergio Villar Senin">svillar</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjA1MTE2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VM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