<?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>223697</bug_id>
          
          <creation_ts>2021-03-24 10:05:10 -0700</creation_ts>
          <short_desc>Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type &apos;int&apos;</short_desc>
          <delta_ts>2021-03-24 12:31:15 -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>Layout and Rendering</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=176131</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="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>sam</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>1743370</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-24 10:05:10 -0700</bug_when>
    <thetext>Fix bug found by UBSan:
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type &apos;int&apos;
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65536 * 65536 cannot be represented in type &apos;int&apos;
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 1116300 * 558150 cannot be represented in type &apos;int&apos;
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: -33554432 * -33554432 cannot be represented in type &apos;int&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743373</commentid>
    <comment_count>1</comment_count>
      <attachid>424150</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-24 10:13:40 -0700</bug_when>
    <thetext>Created attachment 424150
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743379</commentid>
    <comment_count>2</comment_count>
      <attachid>424150</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-24 10:20:50 -0700</bug_when>
    <thetext>Comment on attachment 424150
Patch

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

&gt; Source/WebCore/ChangeLog:13
&gt; +        - Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: -33554432 * -33554432 cannot be represented in type &apos;int&apos;

Surprised that we are computing area of sizes that have negative width or height.

&gt; Source/WebCore/page/FrameView.h:994
&gt; +    if (UNLIKELY(area.hasOverflowed()))

Makes me wish Checked had a &quot;saturation&quot; mode so we didn’t have to write such extensive code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743380</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-24 10:21:55 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #2)
&gt; Comment on attachment 424150 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=424150&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:13
&gt; &gt; +        - Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: -33554432 * -33554432 cannot be represented in type &apos;int&apos;
&gt; 
&gt; Surprised that we are computing area of sizes that have negative width or
&gt; height.

I suspect the values may already overflowed before this function call.

&gt; 
&gt; &gt; Source/WebCore/page/FrameView.h:994
&gt; &gt; +    if (UNLIKELY(area.hasOverflowed()))
&gt; 
&gt; Makes me wish Checked had a &quot;saturation&quot; mode so we didn’t have to write
&gt; such extensive code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743397</commentid>
    <comment_count>4</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2021-03-24 10:36:21 -0700</bug_when>
    <thetext>no test case? I am curios how we end up with negative size here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743398</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-24 10:37:49 -0700</bug_when>
    <thetext>I believe the test case is &quot;our entire regression test suite run when WebKit is compiled with UBSan&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743399</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-24 10:38:07 -0700</bug_when>
    <thetext>(In reply to zalan from comment #4)
&gt; no test case? I am curios how we end up with negative size here.

The UBSan warnings are triggered by our test suite so the values showed in the errors should already be covered by our test suite.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743401</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-24 10:38:53 -0700</bug_when>
    <thetext>(In reply to zalan from comment #4)
&gt; no test case? I am curios how we end up with negative size here.

I believe you should be able to add assertions then run the test suite and hopefully find out :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743402</commentid>
    <comment_count>8</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2021-03-24 10:39:31 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #6)
&gt; (In reply to zalan from comment #4)
&gt; &gt; no test case? I am curios how we end up with negative size here.
&gt; 
&gt; The UBSan warnings are triggered by our test suite so the values showed in
&gt; the errors should already be covered by our test suite.
Can we figure out what test triggered this? This may have correctness implications as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743403</commentid>
    <comment_count>9</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2021-03-24 10:39:41 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #7)
&gt; (In reply to zalan from comment #4)
&gt; &gt; no test case? I am curios how we end up with negative size here.
&gt; 
&gt; I believe you should be able to add assertions then run the test suite and
&gt; hopefully find out :)
ok</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743470</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-03-24 12:30:17 -0700</bug_when>
    <thetext>Committed r274958: &lt;https://commits.webkit.org/r274958&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424150.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743474</commentid>
    <comment_count>11</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-24 12:31:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/75799187&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>424150</attachid>
            <date>2021-03-24 10:13:40 -0700</date>
            <delta_ts>2021-03-24 12:30:18 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-223697-20210324101339.patch</filename>
            <type>text/plain</type>
            <size>2371</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc0OTQxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggYjQwMWQ3MzZiZWY2M2M5
YzNlODQ1N2E3ZjdiNDliMDA5OTBjZjNhMS4uMzZjYmZmNDc1NTlhMTRjYzhiZGE4OW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