<?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>223903</bug_id>
          
          <creation_ts>2021-03-29 13:54:53 -0700</creation_ts>
          <short_desc>UBSan: AlternativeTextController::dismiss()/dismissSoon(): runtime error: load of value nnn, which is not a valid value for type &apos;bool&apos;</short_desc>
          <delta_ts>2021-04-02 14:05:03 -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>HTML Editing</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=174604</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=176131</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=223902</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="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>dbates</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>mifenton</cc>
    
    <cc>ryanhaddad</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1744897</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-29 13:54:53 -0700</bug_when>
    <thetext>Running all layout tests with a Release+UBSan build of WebKit (see Bug 176131) results in ~449 tests hitting this UBSan warning at least once with different values of &quot;nnn&quot;:

    editing/AlternativeTextController.cpp:180:10: runtime error: load of value nnn, which is not a valid value for type &apos;bool&apos;
    editing/AlternativeTextController.cpp:190:10: runtime error: load of value nnn, which is not a valid value for type &apos;bool&apos;

This seems to result from AlternativeTextController::m_isActive not being initialized in the constructor.

In both cases the code that hits the UBSan runtime error is:

    if (!m_isActive)  // UBSan runtime error on line 180 or 190 of editing/AlternativeTextController.cpp.
        return;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1744903</commentid>
    <comment_count>1</comment_count>
      <attachid>424576</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-29 14:00:02 -0700</bug_when>
    <thetext>Created attachment 424576
Patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1744907</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-29 14:05:54 -0700</bug_when>
    <thetext>(In reply to David Kilzer (:ddkilzer) from comment #1)
&gt; Created attachment 424576 [details]
&gt; Patch for EWS

I had a lot of macOS tests (46) fail locally with this patch, but I can&apos;t tell which ones were caused by this patch vs. some other issue, so I&apos;m using EWS to check how many tests might be failing with this change in non-UBSan builds.

I saw both &quot;EDITING DELEGATE&quot; changes and layout/rendering changes locally with WebKit recompiled with UBSan, which is somewhat scary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1744908</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-29 14:08:36 -0700</bug_when>
    <thetext>&lt;rdar://problem/75972281&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1744989</commentid>
    <comment_count>4</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-29 17:16:32 -0700</bug_when>
    <thetext>(In reply to David Kilzer (:ddkilzer) from comment #2)
&gt; (In reply to David Kilzer (:ddkilzer) from comment #1)
&gt; &gt; Created attachment 424576 [details]
&gt; &gt; Patch for EWS
&gt; 
&gt; I had a lot of macOS tests (46) fail locally with this patch, but I can&apos;t
&gt; tell which ones were caused by this patch vs. some other issue, so I&apos;m using
&gt; EWS to check how many tests might be failing with this change in non-UBSan
&gt; builds.
&gt; 
&gt; I saw both &quot;EDITING DELEGATE&quot; changes and layout/rendering changes locally
&gt; with WebKit recompiled with UBSan, which is somewhat scary.

Heh, looks like the failures were just due to UBSan altering the timing of the tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1745008</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-03-29 18:32:20 -0700</bug_when>
    <thetext>If it&apos;s actually timing, maybe we should mark those 46 as flaky preemptively?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1745365</commentid>
    <comment_count>6</comment_count>
      <attachid>424576</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-30 15:27:03 -0700</bug_when>
    <thetext>Comment on attachment 424576
Patch v1

Marking this for review.  No regressions found in EWS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1745367</commentid>
    <comment_count>7</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-30 15:28:57 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #5)
&gt; If it&apos;s actually timing, maybe we should mark those 46 as flaky preemptively?

Sorry, I already overwrote the results.  I&apos;m going to run them again soon, so I&apos;ll take a closer look at the results and maybe suggest some suggestions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1745368</commentid>
    <comment_count>8</comment_count>
      <attachid>424576</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-30 15:31:39 -0700</bug_when>
    <thetext>Comment on attachment 424576
Patch v1

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

&gt; Source/WebCore/editing/AlternativeTextController.h:125
&gt; +    bool m_isActive { };
&gt; +    bool m_isDismissedByEditing { };

Note for reviewers: only m_isActive was identified by UBSSan as being used uninitialized.

However, m_isDismissedByEditing is also uninitialized in the current constructor, so I&apos;m making this change at the same time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1745728</commentid>
    <comment_count>9</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2021-03-31 12:30:35 -0700</bug_when>
    <thetext>Review ping! :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1746657</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-04-02 14:05:00 -0700</bug_when>
    <thetext>Committed r275436: &lt;https://commits.webkit.org/r275436&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424576.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>424576</attachid>
            <date>2021-03-29 14:00:02 -0700</date>
            <delta_ts>2021-04-02 14:05:01 -0700</delta_ts>
            <desc>Patch v1</desc>
            <filename>bug-223903-20210329140001.patch</filename>
            <type>text/plain</type>
            <size>1828</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc1MTM3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNGJhOWFjYjdkYTczMGZi
MDU3NzRhMGVkY2Y2NjMyMGU4MzA5ODI1My4uZGU5MWU4N2Q1NDMyZjhkMjU3YzNmZGUxOGUwMjg1
YjQ3YjRkNzc0YSAxMDA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