<?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>116886</bug_id>
          
          <creation_ts>2013-05-28 13:41:06 -0700</creation_ts>
          <short_desc>Rendering suppression extension tokens shouldn&apos;t be 0, should handle overflow</short_desc>
          <delta_ts>2013-05-28 14:54:51 -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>WebKit2</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Horton">thorton</reporter>
          <assigned_to name="Tim Horton">thorton</assigned_to>
          <cc>aestes</cc>
    
    <cc>commit-queue</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>894491</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2013-05-28 13:41:06 -0700</bug_when>
    <thetext>Apparently 0 is not a good value to try to insert into a HashSet.

From http://trac.webkit.org/changeset/150388</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894492</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2013-05-28 13:42:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/14004474&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894504</commentid>
    <comment_count>2</comment_count>
      <attachid>203086</attachid>
    <who name="Tim Horton">thorton</who>
    <bug_when>2013-05-28 14:14:22 -0700</bug_when>
    <thetext>Created attachment 203086
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894505</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-05-28 14:15:52 -0700</bug_when>
    <thetext>Attachment 203086 did not pass style-queue:

Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;Source/WebKit2/ChangeLog&apos;, u&apos;Source/WebKit2/WebProcess/WebPage/WebPage.cpp&apos;]&quot; exit_code: 1
Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4199:  Missing space before ( in while(  [whitespace/parens] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894511</commentid>
    <comment_count>4</comment_count>
      <attachid>203086</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-05-28 14:20:18 -0700</bug_when>
    <thetext>Comment on attachment 203086
patch

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

r=me assuming you deal with the 0xFFFFFFFF problem.

&gt;&gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4199
&gt;&gt; +    while(!token || m_activeRenderingSuppressionTokens.contains(token))
&gt; 
&gt; Missing space before ( in while(  [whitespace/parens] [5]

First, let me say to the stylebot that I agree!

Second, there are two values that a HashSet&lt;unsigned&gt; can’t handle. One is 0, and one is 0xFFFFFFFF. This code will call contains with 0xFFFFFFFF, which is a no-no. The way to deal with that is to use the isValidValue function instead of special casing zero.

    while (!token || !m_activeRenderingSuppressionTokens.isValidValue(token) || m_activeRenderingSuppressionTokens.contains(token))

There are two flaws with the code I pasted in here. One is that it’s probably more elegant to use a class name to call a static member function rather than using an instance to do so. The other is that it’s a little strange to have two checks for zero, one in this code and one in the isValidValue function; not sure the compiler will optimize one of them out.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894513</commentid>
    <comment_count>5</comment_count>
      <attachid>203086</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-05-28 14:22:07 -0700</bug_when>
    <thetext>Comment on attachment 203086
patch

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

&gt;&gt;&gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4199
&gt;&gt;&gt; +    while(!token || m_activeRenderingSuppressionTokens.contains(token))
&gt;&gt; 
&gt;&gt; Missing space before ( in while(  [whitespace/parens] [5]
&gt; 
&gt; First, let me say to the stylebot that I agree!
&gt; 
&gt; Second, there are two values that a HashSet&lt;unsigned&gt; can’t handle. One is 0, and one is 0xFFFFFFFF. This code will call contains with 0xFFFFFFFF, which is a no-no. The way to deal with that is to use the isValidValue function instead of special casing zero.
&gt; 
&gt;     while (!token || !m_activeRenderingSuppressionTokens.isValidValue(token) || m_activeRenderingSuppressionTokens.contains(token))
&gt; 
&gt; There are two flaws with the code I pasted in here. One is that it’s probably more elegant to use a class name to call a static member function rather than using an instance to do so. The other is that it’s a little strange to have two checks for zero, one in this code and one in the isValidValue function; not sure the compiler will optimize one of them out.

You could just leave out the &quot;!token&quot; part if the only reason you were ruling out zero was to avoid the bad hash set value.

&gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4200
&gt; +        token++;

This ought to be:

    token = ++m_maximumRenderingSuppressionToken;

Don’t you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894514</commentid>
    <comment_count>6</comment_count>
      <attachid>203086</attachid>
    <who name="Andy Estes">aestes</who>
    <bug_when>2013-05-28 14:22:46 -0700</bug_when>
    <thetext>Comment on attachment 203086
patch

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

&gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4198
&gt; +    unsigned token = ++m_maximumRenderingSuppressionToken;

You could make this &apos;unsigned token = m_maximumRenderingSuppressionToken + 1&apos;, since you&apos;ll update m_maximumRenderingSuppressionToken a few lines later. No need to update it twice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894532</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2013-05-28 14:47:43 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (From update of attachment 203086 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=203086&amp;action=review
&gt; 
&gt; &gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4198
&gt; &gt; +    unsigned token = ++m_maximumRenderingSuppressionToken;
&gt; 
&gt; You could make this &apos;unsigned token = m_maximumRenderingSuppressionToken + 1&apos;, since you&apos;ll update m_maximumRenderingSuppressionToken a few lines later. No need to update it twice.

Agreed.

(In reply to comment #5)
&gt; You could just leave out the &quot;!token&quot; part if the only reason you were ruling out zero was to avoid the bad hash set value.

That is the only reason, so yeah, I&apos;ll leave it out.

&gt; &gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4200
&gt; &gt; +        token++;
&gt; 
&gt; This ought to be:
&gt; 
&gt;     token = ++m_maximumRenderingSuppressionToken;
&gt; 
&gt; Don’t you think?

As Andy notes, I update m_maximumRenderingSuppressionToken a few lines below.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894534</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2013-05-28 14:49:48 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; (From update of attachment 203086 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=203086&amp;action=review
&gt; 
&gt; r=me assuming you deal with the 0xFFFFFFFF problem.

Thanks!

&gt; First, let me say to the stylebot that I agree!

Me too!

&gt; Second, there are two values that a HashSet&lt;unsigned&gt; can’t handle. One is 0, and one is 0xFFFFFFFF. This code will call contains with 0xFFFFFFFF, which is a no-no. The way to deal with that is to use the isValidValue function instead of special casing zero.

I did not know that!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>894541</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2013-05-28 14:54:51 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/150838</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>203086</attachid>
            <date>2013-05-28 14:14:22 -0700</date>
            <delta_ts>2013-05-28 14:22:46 -0700</delta_ts>
            <desc>patch</desc>
            <filename>incrender.diff</filename>
            <type>text/plain</type>
            <size>1576</size>
            <attacher name="Tim Horton">thorton</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQyL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQyL0No
YW5nZUxvZwppbmRleCBiY2UyNjJmLi5lZDM5MmNjIDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViS2l0
Mi9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYktpdDIvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTcg
QEAKKzIwMTMtMDUtMjggIFRpbSBIb3J0b24gIDx0aW1vdGh5X2hvcnRvbkBhcHBsZS5jb20+CisK
KyAgICAgICAgUmVuZGVyaW5nIHN1cHByZXNzaW9uIGV4dGVuc2lvbiB0b2tlbnMgc2hvdWxkbid0
IGJlIDAsIHNob3VsZCBoYW5kbGUgb3ZlcmZsb3cKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtp
dC5vcmcvc2hvd19idWcuY2dpP2lkPTExNjg4NgorICAgICAgICA8cmRhcjovL3Byb2JsZW0vMTQw
MDQ0NzQ+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
RG9uJ3QgdXNlIDAgYXMgYSB0b2tlbiwgYW5kIGVuc3VyZSB0aGF0IHdlJ3Jl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doaWxlKCF0b2tlbiB8fCBtX2FjdGl2ZVJl
bmRlcmluZ1N1cHByZXNzaW9uVG9rZW5zLmNvbnRhaW5zKHRva2VuKSkKKyAgICAgICAgdG9rZW4r
KzsKIAogICAgIG1fYWN0aXZlUmVuZGVyaW5nU3VwcHJlc3Npb25Ub2tlbnMuYWRkKHRva2VuKTsK
ICAgICBtX3BhZ2UtPm1haW5GcmFtZSgpLT52aWV3KCktPnNldFZpc3VhbFVwZGF0ZXNBbGxvd2Vk
QnlDbGllbnQoZmFsc2UpOwogCisgICAgbV9tYXhpbXVtUmVuZGVyaW5nU3VwcHJlc3Npb25Ub2tl
biA9IHRva2VuOworCiAgICAgcmV0dXJuIHRva2VuOwogfQogCg==
</data>
<flag name="review"
          id="224543"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>