<?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>219615</bug_id>
          
          <creation_ts>2020-12-07 14:11:22 -0800</creation_ts>
          <short_desc>Make TextRun::subRun stricter</short_desc>
          <delta_ts>2021-02-05 21:30:51 -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>Text</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=218488</see_also>
          <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="Rob Buis">rbuis</reporter>
          <assigned_to name="Rob Buis">rbuis</assigned_to>
          <cc>darin</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>koivisto</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1712613</commentid>
    <comment_count>0</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-07 14:11:22 -0800</bug_when>
    <thetext>Make TextRun::subRun stricter, besides the start offset being less than the run
length, the sub run start offset plus sub run length should not exceed the
overall run length.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712614</commentid>
    <comment_count>1</comment_count>
      <attachid>415584</attachid>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-07 14:14:02 -0800</bug_when>
    <thetext>Created attachment 415584
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712627</commentid>
    <comment_count>2</comment_count>
      <attachid>415584</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-12-07 14:52:03 -0800</bug_when>
    <thetext>Comment on attachment 415584
Patch

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

&gt; Source/WebCore/platform/graphics/TextRun.h:69
&gt; -        ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_text.length());
&gt; +        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_text.length() &amp;&amp; (startOffset + length) &lt;= m_text.length());

The old assertion is redundant. We already have those assertions in data8 and data16. So we could consider only the new assertion, and not repeating the old assertion.

Bold to change this to RELEASE_ASSERT, but strange to change this, and not data8, data16, operator[] or other idioms that are not member functions. Not sure what the rationale is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712685</commentid>
    <comment_count>3</comment_count>
      <attachid>415584</attachid>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-07 21:56:17 -0800</bug_when>
    <thetext>Comment on attachment 415584
Patch

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

&gt;&gt; Source/WebCore/platform/graphics/TextRun.h:69
&gt;&gt; +        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_text.length() &amp;&amp; (startOffset + length) &lt;= m_text.length());
&gt; 
&gt; The old assertion is redundant. We already have those assertions in data8 and data16. So we could consider only the new assertion, and not repeating the old assertion.
&gt; 
&gt; Bold to change this to RELEASE_ASSERT, but strange to change this, and not data8, data16, operator[] or other idioms that are not member functions. Not sure what the rationale is.

I believe there will be a style warning when keeping ASSERT_WITH_SECURITY_IMPLICATION.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712771</commentid>
    <comment_count>4</comment_count>
      <attachid>415636</attachid>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-08 06:39:05 -0800</bug_when>
    <thetext>Created attachment 415636
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712773</commentid>
    <comment_count>5</comment_count>
      <attachid>415584</attachid>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-08 06:40:45 -0800</bug_when>
    <thetext>Comment on attachment 415584
Patch

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

&gt;&gt;&gt; Source/WebCore/platform/graphics/TextRun.h:69
&gt;&gt;&gt; +        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_text.length() &amp;&amp; (startOffset + length) &lt;= m_text.length());
&gt;&gt; 
&gt;&gt; The old assertion is redundant. We already have those assertions in data8 and data16. So we could consider only the new assertion, and not repeating the old assertion.
&gt;&gt; 
&gt;&gt; Bold to change this to RELEASE_ASSERT, but strange to change this, and not data8, data16, operator[] or other idioms that are not member functions. Not sure what the rationale is.
&gt; 
&gt; I believe there will be a style warning when keeping ASSERT_WITH_SECURITY_IMPLICATION.

I removed the old assertion and brought back the ASSERT_WITH_SEC. FWIW this is the style error:
ERROR: Source/WebCore/platform/graphics/TextRun.h:69:  Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION().  [security/assertion] [5]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712809</commentid>
    <comment_count>6</comment_count>
      <attachid>415584</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-12-08 09:07:53 -0800</bug_when>
    <thetext>Comment on attachment 415584
Patch

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

&gt;&gt;&gt;&gt; Source/WebCore/platform/graphics/TextRun.h:69
&gt;&gt;&gt;&gt; +        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_text.length() &amp;&amp; (startOffset + length) &lt;= m_text.length());
&gt;&gt;&gt; 
&gt;&gt;&gt; The old assertion is redundant. We already have those assertions in data8 and data16. So we could consider only the new assertion, and not repeating the old assertion.
&gt;&gt;&gt; 
&gt;&gt;&gt; Bold to change this to RELEASE_ASSERT, but strange to change this, and not data8, data16, operator[] or other idioms that are not member functions. Not sure what the rationale is.
&gt;&gt; 
&gt;&gt; I believe there will be a style warning when keeping ASSERT_WITH_SECURITY_IMPLICATION.
&gt; 
&gt; I removed the old assertion and brought back the ASSERT_WITH_SEC. FWIW this is the style error:
&gt; ERROR: Source/WebCore/platform/graphics/TextRun.h:69:  Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION().  [security/assertion] [5]

I think David Kilzer created that style warning. Might be worth consulting with him.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712812</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-12-08 09:22:14 -0800</bug_when>
    <thetext>Committed r270541: &lt;https://trac.webkit.org/changeset/270541&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415636.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712813</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-12-08 09:23:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/72095633&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712814</commentid>
    <comment_count>9</comment_count>
    <who name="Rob Buis">rbuis</who>
    <bug_when>2020-12-08 09:25:33 -0800</bug_when>
    <thetext>@ddkilzer: is the style check maybe too strong for this kind of patch? I chose to ignore it:
ERROR: Source/WebCore/platform/graphics/TextRun.h:69:  Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION().  [security/assertion] [5]

Is it maybe better to have it as a warning or advice?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726127</commentid>
    <comment_count>10</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-02-05 09:40:56 -0800</bug_when>
    <thetext>(In reply to Rob Buis from comment #9)
&gt; @ddkilzer: is the style check maybe too strong for this kind of patch? I
&gt; chose to ignore it:
&gt; ERROR: Source/WebCore/platform/graphics/TextRun.h:69:  Please replace
&gt; ASSERT_WITH_SECURITY_IMPLICATION() with
&gt; RELEASE_ASSERT_WITH_SECURITY_IMPLICATION().  [security/assertion] [5]
&gt; 
&gt; Is it maybe better to have it as a warning or advice?

We want to decrease use of ASSERT_WITH_SECURITY_IMPLICATION() over time because if the security issue is bad enough to assert in a Debug build, then we are likely hiding the issue in Release builds.

Notice that git/commit-queue doesn&apos;t enforce this, so you were still able to land the patch.  The point is that this is to make you think twice about using ASSERT_WITH_SECURITY_IMPLICATION() going forward.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726361</commentid>
    <comment_count>11</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2021-02-05 21:30:51 -0800</bug_when>
    <thetext>We probably can&apos;t use release assert here since TextRun needs to be lightweight &amp; fast. Might be worth experimenting with trying to use release assert &amp; run all the benchmarks we have to see if it negatively impacts it or not.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>415584</attachid>
            <date>2020-12-07 14:14:02 -0800</date>
            <delta_ts>2020-12-08 06:38:59 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-219615-20201207231359.patch</filename>
            <type>text/plain</type>
            <size>1468</size>
            <attacher name="Rob Buis">rbuis</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjcwNDg2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggY2JiNzdjYjNjM2I2N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mNlL1dlYkNvcmUvcGxh
dGZvcm0vZ3JhcGhpY3MvVGV4dFJ1bi5oCmluZGV4IGVjYmM1ZWVhOWI5ZDFlM2UzYzQ1MTNhZjU4
MDY3ZTU3ZTgyYTVkYTcuLjQ5NWYzZTI4ZTk2MGNiZGZiNDc4YzNjMTk3NjVhNmZmZWFlZjM2NWMg
MTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL2dyYXBoaWNzL1RleHRSdW4uaAor
KysgYi9Tb3VyY2UvV2ViQ29yZS9wbGF0Zm9ybS9ncmFwaGljcy9UZXh0UnVuLmgKQEAgLTY2LDcg
KzY2LDcgQEAgcHVibGljOgogCiAgICAgVGV4dFJ1biBzdWJSdW4odW5zaWduZWQgc3RhcnRPZmZz
ZXQsIHVuc2lnbmVkIGxlbmd0aCkgY29uc3QKICAgICB7Ci0gICAgICAgIEFTU0VSVF9XSVRIX1NF
Q1VSSVRZX0lNUExJQ0FUSU9OKHN0YXJ0T2Zmc2V0IDwgbV90ZXh0Lmxlbmd0aCgpKTsKKyAgICAg
ICAgUkVMRUFTRV9BU1NFUlRfV0lUSF9TRUNVUklUWV9JTVBMSUNBVElPTihzdGFydE9mZnNldCA8
IG1fdGV4dC5sZW5ndGgoKSAmJiAoc3RhcnRPZmZzZXQgKyBsZW5ndGgpIDw9IG1fdGV4dC5sZW5n
dGgoKSk7CiAKICAgICAgICAgYXV0byByZXN1bHQgeyAqdGhpcyB9OwogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>415636</attachid>
            <date>2020-12-08 06:39:05 -0800</date>
            <delta_ts>2020-12-08 09:22:15 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-219615-20201208153903.patch</filename>
            <type>text/plain</type>
            <size>1431</size>
            <attacher name="Rob Buis">rbuis</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjcwNTM1CmRpZmYgLS1naX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