<?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>274780</bug_id>
          
          <creation_ts>2024-05-28 08:22:18 -0700</creation_ts>
          <short_desc>[WPE][GTK] Crash in WebCore::TextDecorationPainter::paintBackgroundDecorations when compiled with Clang with LTO enabled</short_desc>
          <delta_ts>2024-08-16 03:46:12 -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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2281612</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="Milan Crha">mcrha</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>adamw</cc>
    
    <cc>aperez</cc>
    
    <cc>bfulgham</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mikhail.v.gavrilov</cc>
    
    <cc>muziknavi</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>yaneti</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2038193</commentid>
    <comment_count>0</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2024-05-28 08:22:18 -0700</bug_when>
    <thetext>Moving this from a downstream bug:
https://gitlab.gnome.org/GNOME/evolution/-/issues/2759

Reproducer with MiniBrowser from webkit2gtk4.1-2.45.2-2.fc41.x86_64:
a) run from a terminal:
   /usr/libexec/webkit2gtk-4.1/MiniBrowser https://www.gnome.org
b) click on the &quot;Get GNOME&quot; link at the top (or maybe other)

The terminal says:
** (MiniBrowser:6350): WARNING **: 17:12:18.205: WebProcess CRASHED

After which also the MiniBrowser itself crashes.

coredumpctl says:

Tue 2024-05-28 17:12:18 CEST 6372 1000 1000 SIGSEGV none     /usr/libexec/webkit2gtk-4.1/WebKitWebProcess    -
Tue 2024-05-28 17:12:21 CEST 6350 1000 1000 SIGSEGV present  /usr/libexec/webkit2gtk-4.1/MiniBrowser      5.9M

The WebProcess gdb output (the downstream bug contains a different backtrace though):


Thread 1 &quot;WebKitWebProces&quot; received signal SIGSEGV, Segmentation fault.
0x00007fa99ee42938 in auto WebCore::TextDecorationPainter::paintBackgroundDecorations(WebCore::RenderStyle const&amp;, WebCore::TextRun const&amp;, WebCore::TextDecorationPainter::BackgroundDecorationGeometry const&amp;, WTF::OptionSet&lt;WebCore::TextDecorationLine&gt;, WebCore::TextDecorationPainter::Styles const&amp;)::$_0::operator()&lt;WebCore::TextDecorationLine, WebCore::TextDecorationStyle, WebCore::Color const, WebCore::FloatRect&gt;(WebCore::TextDecorationLine, WebCore::TextDecorationStyle, WebCore::Color const&amp;, WebCore::FloatRect&amp;) const () from /lib64/libwebkit2gtk-4.1.so.0

(gdb) bt
#0  0x00007fa99ee42938 in auto WebCore::TextDecorationPainter::paintBackgroundDecorations(WebCore::RenderStyle const&amp;, WebCore::TextRun const&amp;, WebCore::TextDecorationPainter::BackgroundDecorationGeometry const&amp;, WTF::OptionSet&lt;WebCore::TextDecorationLine&gt;, WebCore::TextDecorationPainter::Styles const&amp;)::$_0::operator()&lt;WebCore::TextDecorationLine, WebCore::TextDecorationStyle, WebCore::Color const, WebCore::FloatRect&gt;(WebCore::TextDecorationLine, WebCore::TextDecorationStyle, WebCore::Color const&amp;, WebCore::FloatRect&amp;) const () at /lib64/libwebkit2gtk-4.1.so.0
#1  0x00007fa99ee37ba0 in WebCore::TextDecorationPainter::paintBackgroundDecorations(WebCore::RenderStyle const&amp;, WebCore::TextRun const&amp;, WebCore::TextDecorationPainter::BackgroundDecorationGeometry const&amp;, WTF::OptionSet&lt;WebCore::TextDecorationLine&gt;, WebCore::TextDecorationPainter::Styles const&amp;) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#2  0x00007fa99ee33811 in WebCore::TextBoxPainter&lt;WebCore::InlineIterator::BoxModernPath&gt;::paintForegroundAndDecorations() ()
    at /lib64/libwebkit2gtk-4.1.so.0
#3  0x00007fa99ee30ab8 in WebCore::TextBoxPainter&lt;WebCore::InlineIterator::BoxModernPath&gt;::paint() () at /lib64/libwebkit2gtk-4.1.so.0
#4  0x00007fa99e6547ed in WebCore::LayoutIntegration::InlineContentPainter::paintDisplayBox(WebCore::InlineDisplay::Box const&amp;) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#5  0x00007fa99e65494b in WebCore::LayoutIntegration::InlineContentPainter::paint() () at /lib64/libwebkit2gtk-4.1.so.0
#6  0x00007fa99e65a913 in WebCore::LayoutIntegration::LineLayout::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::RenderInline const*) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#7  0x00007fa99ec6ef37 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#8  0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#9  0x00007fa99ec6e523 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#10 0x00007fa99ec6e31f in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#11 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#12 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#13 0x00007fa99ecdd7a3 in WebCore::RenderElement::paintAsInlineBlock(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#14 0x00007fa99ec6e50e in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#15 0x00007fa99ecf31af in WebCore::RenderFlexibleBox::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#16 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#17 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#18 0x00007fa99ec6e523 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#19 0x00007fa99ec6e31f in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#20 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#21 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#22 0x00007fa99ec6e523 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#23 0x00007fa99ec6e31f in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#24 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#25 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#26 0x00007fa99ec6e523 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#27 0x00007fa99ec6e31f in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#28 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#29 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#30 0x00007fa99ec6e523 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&amp;, WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool, WebCore::RenderBlock::PaintBlockType) () at /lib64/libwebkit2gtk-4.1.so.0
#31 0x00007fa99ec6e31f in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;, WebCore::PaintInfo&amp;, bool) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#32 0x00007fa99ec6ef1f in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#33 0x00007fa99ec6db9e in WebCore::RenderBlock::paint(WebCore::PaintInfo&amp;, WebCore::LayoutPoint const&amp;) () at /lib64/libwebkit2gtk-4.1.so.0
#34 0x00007fa99ed380f9 in WebCore::RenderLayer::paintForegroundForFragmentsWithPhase(WebCore::PaintPhase, WTF::Vector&lt;WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt; const&amp;, WebCore::GraphicsContext&amp;, WebCore::RenderLayer::LayerPaintingInfo const&amp;, WTF::OptionSet&lt;WebCore::PaintBehavior&gt;, WebCore::RenderObject*) () at /lib64/libwebkit2gtk-4.1.so.0
#35 0x00007fa99ed3285b in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&amp;, WebCore::RenderLayer::LayerPaintingInfo const&amp;, WTF::OptionSet&lt;WebCore::RenderLayer::PaintLayerFlag&gt;) () at /lib64/libwebkit2gtk-4.1.so.0
#36 0x00007fa99ed332f2 in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&amp;, WebCore::RenderLayer::LayerPaintingInfo const&amp;, WTF::OptionSet&lt;WebCore::RenderLayer::PaintLayerFlag&gt;) () at /lib64/libwebkit2gtk-4.1.so.0
#37 0x00007fa99ed332f2 in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&amp;, WebCore::RenderLayer::LayerPaintingInfo const&amp;, WTF::OptionSet&lt;WebCore::RenderLayer::PaintLayerFlag&gt;) () at /lib64/libwebkit2gtk-4.1.so.0
#38 0x00007fa99ed535d4 in WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&amp;, WebCore::IntRect const&amp;, WTF::OptionSet&lt;WebCore::PaintBehavior&gt;, WebCore::RegionContext*)::$_0::operator()(WebCore::RenderLayer&amp;, WTF::OptionSet&lt;WebCore::RenderLayer::PaintLayerFlag&gt;) const () at /lib64/libwebkit2gtk-4.1.so.0
#39 0x00007fa99ed53082 in WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&amp;, WebCore::IntRect const&amp;, WTF::OptionSet&lt;WebCore::PaintBehavior&gt;, WebCore::RegionContext*) () at /lib64/libwebkit2gtk-4.1.so.0
#40 0x00007fa99ed53e4b in WebCore::RenderLayerBacking::paintContents(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&amp;, WebCore::FloatRect const&amp;, WTF::OptionSet&lt;WebCore::GraphicsLayerPaintBehavior&gt;) () at /lib64/libwebkit2gtk-4.1.so.0
#41 0x00007fa99ce89e99 in WebCore::CoordinatedGraphicsLayer::paintTile(WebCore::IntRect const&amp;, WebCore::IntRect const&amp;, float)::$_1::operator()(WebCore::GraphicsContext&amp;) const () at /lib64/libwebkit2gtk-4.1.so.0
#42 0x00007fa99ce89803 in WebCore::CoordinatedGraphicsLayer::paintTile(WebCore::IntRect const&amp;, WebCore::IntRect const&amp;, float) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#43 0x00007fa99ce859dc in WebCore::CoordinatedGraphicsLayer::updateContentBuffers() () at /lib64/libwebkit2gtk-4.1.so.0
#44 0x00007fa99ce850e6 in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#45 0x00007fa99ce8511c in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#46 0x00007fa99ce8511c in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#47 0x00007fa99ce8511c in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#48 0x00007fa99ce8511c in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#49 0x00007fa99ce8511c in WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() () at /lib64/libwebkit2gtk-4.1.so.0
#50 0x00007fa99cdffbfd in WebKit::CompositingCoordinator::flushPendingLayerChanges(WTF::OptionSet&lt;WebCore::FinalizeRenderingUpdateFlags&gt;) ()
    at /lib64/libwebkit2gtk-4.1.so.0
#51 0x00007fa99ce0ba65 in WebKit::LayerTreeHost::layerFlushTimerFired() () at /lib64/libwebkit2gtk-4.1.so.0
#52 0x00007fa99baaca85 in WTF::RunLoop::TimerBase::TimerBase(WTF::RunLoop&amp;)::$_0::__invoke(void*) [clone .llvm.2038710169385785088] ()
    at /lib64/libjavascriptcoregtk-4.1.so.0
#53 0x00007fa99baab831 in WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) () at /lib64/libjavascriptcoregtk-4.1.so.0
#54 0x00007fa99820c90c in g_main_context_dispatch_unlocked.lto_priv () at /lib64/libglib-2.0.so.0
#55 0x00007fa99826d978 in g_main_context_iterate_unlocked.isra () at /lib64/libglib-2.0.so.0
#56 0x00007fa9982128c7 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#57 0x00007fa99baabe29 in WTF::RunLoop::run() () at /lib64/libjavascriptcoregtk-4.1.so.0
#58 0x00007fa99ce185ac in WebKit::WebProcessMain(int, char**) () at /lib64/libwebkit2gtk-4.1.so.0
#59 0x00007fa99c23c1c8 in __libc_start_call_main () at /lib64/libc.so.6
#60 0x00007fa99c23c28b in __libc_start_main_impl () at /lib64/libc.so.6
#61 0x0000000000401075 in _start ()

=======================================================================

The MiniBrowser backtrace:

(gdb) bt
#0  0x00007f629e092502 in WebKit::WebPageProxy::keyEventHandlingCompleted(std::optional&lt;WebKit::WebEventType&gt;, bool) () at /lib64/libwebkit2gtk-4.1.so.0
#1  0x00007f629e00fb1f in WTF::Detail::CallableWrapper&lt;WebKit::AuxiliaryProcessProxy::sendMessage(WTF::UniqueRef&lt;IPC::Encoder&gt;&amp;&amp;, WTF::OptionSet&lt;IPC::SendOption&gt;, std::optional&lt;IPC::ConnectionAsyncReplyHandler&gt;, WebKit::AuxiliaryProcessProxy::ShouldStartProcessThrottlerActivity)::$_1, void, IPC::Decoder*&gt;::call(IPC::Decoder*) () at /lib64/libwebkit2gtk-4.1.so.0
#2  0x00007f629dfd7d81 in WTF::Detail::CallableWrapper&lt;IPC::Connection::sendMessageWithAsyncReply(WTF::UniqueRef&lt;IPC::Encoder&gt;&amp;&amp;, IPC::ConnectionAsyncReplyHandler, WTF::OptionSet&lt;IPC::SendOption&gt;, std::optional&lt;WTF::Thread::QOS&gt;)::$_0, void&gt;::call() [clone .llvm.15857245043833178621] ()
    at /lib64/libwebkit2gtk-4.1.so.0
#3  0x00007f629ca4430b in WTF::RunLoop::performWork() () at /lib64/libjavascriptcoregtk-4.1.so.0
#4  0x00007f629caac9dd in WTF::RunLoop::RunLoop()::$_0::__invoke(void*) () at /lib64/libjavascriptcoregtk-4.1.so.0
#5  0x00007f629caab831 in WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) () at /lib64/libjavascriptcoregtk-4.1.so.0
#6  0x00007f62a21f290c in g_main_context_dispatch_unlocked.lto_priv () at /lib64/libglib-2.0.so.0
#7  0x00007f62a2253978 in g_main_context_iterate_unlocked.isra () at /lib64/libglib-2.0.so.0
#8  0x00007f62a21f3d83 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#9  0x00007f629b3135bd in g_application_run () at /lib64/libgio-2.0.so.0
#10 0x00000000004194ed in main ()


P.S.: the debuginfo for WebKitGTK is too large, I&apos;m sorry</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038194</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-05-28 08:29:39 -0700</bug_when>
    <thetext>This might be a GCC LTO bug, see https://bugzilla.redhat.com/show_bug.cgi?id=2281612</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038196</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-05-28 08:56:39 -0700</bug_when>
    <thetext>Wait, we switch to Clang because that&apos;s recommended for building Skia, so it can&apos;t be a GCC bug. :P</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038437</commentid>
    <comment_count>3</comment_count>
      <attachid>471541</attachid>
    <who name="Yanko Kaneti">yaneti</who>
    <bug_when>2024-05-29 07:19:23 -0700</bug_when>
    <thetext>Created attachment 471541
test -fno-lto for TextDecorationPainter.cpp

As a learning experiment tried to isolate TextDecorationPainter.cpp from LTO and the result seems to not crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038443</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-05-29 07:44:40 -0700</bug_when>
    <thetext>Which version of Clang resulted in the TextDecorationPainter crash? I used
to hit this often, but now using Clang 17 the problems seems to be gone.

I don&apos;t remember which version of Clang I had at the time, but I remembered
that I had a workaround in one of my Git stashes that I never got to truly
understand why it made things work... I had the intention of reporting the
issue to the LLVM/Clang people but never got round to it.

Here&apos;s the workaround:

---- 8&lt; ---- 8&lt; ----

diff --git a/Source/WebCore/rendering/TextDecorationPainter.cpp b/Source/WebCore/rendering/TextDecorationPainter.cpp
index 895c512156da..02d8f00d5aae 100644
--- a/Source/WebCore/rendering/TextDecorationPainter.cpp
+++ b/Source/WebCore/rendering/TextDecorationPainter.cpp
@@ -128,25 +128,26 @@ static DashArray translateIntersectionPointsToSkipInkBoundaries(const DashArray&amp;
     // Step 2: Deal with intersecting ranges.
     Vector&lt;std::pair&lt;float, float&gt;&gt; intermediateTuples;
     if (tuples.size() &gt;= 2) {
-        intermediateTuples.append(*tuples.begin());
-        for (auto i = tuples.begin() + 1; i != tuples.end(); i++) {
+        intermediateTuples.append(tuples[0]);
+        for (size_t i = 1; i &lt; tuples.size(); i++) {
             float&amp; firstEnd = intermediateTuples.last().second;
-            float secondStart = i-&gt;first;
-            float secondEnd = i-&gt;second;
+            float secondStart = tuples[i].first;
+            float secondEnd = tuples[i].second;
             if (secondStart &lt;= firstEnd &amp;&amp; secondEnd &lt;= firstEnd) {
                 // Ignore this range completely
             } else if (secondStart &lt;= firstEnd)
                 firstEnd = secondEnd;
             else
-                intermediateTuples.append(*i);
+                intermediateTuples.append(tuples[i]);
         }
     } else
-        intermediateTuples = tuples;
+        intermediateTuples = WTFMove(tuples);
 
     // Step 3: Output the space between the ranges, but only if the space warrants an underline.
     float previous = 0;
     DashArray result;
-    for (const auto&amp; tuple : intermediateTuples) {
+    for (size_t i = 0; i &lt; intermediateTuples.size(); i++) {
+        const auto&amp; tuple = intermediateTuples[i];
         if (tuple.first - previous &gt; dilationAmount) {
             result.append(previous);
             result.append(tuple.first);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038444</commentid>
    <comment_count>5</comment_count>
    <who name="Yanko Kaneti">yaneti</who>
    <bug_when>2024-05-29 07:48:19 -0700</bug_when>
    <thetext>&gt; Which version of Clang resulted in the TextDecorationPainter crash? I used
&gt; to hit this often, but now using Clang 17 the problems seems to be gone.

Rawhide is currently on Clang 18.1.6(In reply to Adrian Perez from comment #4)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038461</commentid>
    <comment_count>6</comment_count>
    <who name="Adam Williamson">adamw</who>
    <bug_when>2024-05-29 08:21:31 -0700</bug_when>
    <thetext>The webkitgtk build I&apos;m using was built with 18.1.4-3.fc41 . Other reporters have said a more recent build done with 18.1.6-3.fc41 is also affected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038582</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-05-29 14:51:40 -0700</bug_when>
    <thetext>Well I had started a build that disables LTO, but let&apos;s try Adrian&apos;s patch instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038727</commentid>
    <comment_count>8</comment_count>
    <who name="Yanko Kaneti">yaneti</who>
    <bug_when>2024-05-30 01:55:59 -0700</bug_when>
    <thetext>Thanks, webkitgtk-2.45.3-3.fc41 works for me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039021</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-05-31 06:16:40 -0700</bug_when>
    <thetext>*** Bug 274956 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2043134</commentid>
    <comment_count>10</comment_count>
    <who name="Yanko Kaneti">yaneti</who>
    <bug_when>2024-06-25 23:59:13 -0700</bug_when>
    <thetext>AFAICS this fix hasn&apos;t landed yet.

@mcatanzaro now that you&apos;ve removed it? in rawhide,  webkitgtk-2.45.4-1.fc41 is crashing again</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2043175</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-06-26 06:43:24 -0700</bug_when>
    <thetext>Oops, I just assumed we had fixed this. I&apos;ll restore the patch in rawhide.

I guess we&apos;ll just need to land Adrian&apos;s patch, even though it makes the code worse. Adrian, do you want to create a pull request?

Unfortunately switching from GCC to Clang means it&apos;s going to be harder to attract compiler developers to investigate the bug reports, and LTO bugs are by far the hardest to report. It&apos;s probably not realistic to expect us to get a useful compiler bug report here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2043176</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-06-26 06:44:58 -0700</bug_when>
    <thetext>Or we could land Yanko&apos;s patch instead, removing TextDecorationPainter.cpp from the unified build and adding -fno-lto.

(In reply to Michael Catanzaro from comment #11)
&gt; It&apos;s probably not realistic to expect us to
&gt; get a useful compiler bug report here.

If anybody *does* have time to report a Clang bug, that would be wonderful and ideal. But it won&apos;t be easy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2043254</commentid>
    <comment_count>13</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-06-26 13:42:40 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #11)
&gt; I guess we&apos;ll just need to land Adrian&apos;s patch, even though it makes the
&gt; code worse. Adrian, do you want to create a pull request?

We agreed I&apos;ll create a pull request for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2044522</commentid>
    <comment_count>14</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-07-03 13:08:53 -0700</bug_when>
    <thetext>Unfortunately I&apos;m not able to reproduce this crash in my development build. Unassigning myself.

I think I&apos;ll just turn off LTO in Fedora again. That&apos;s easier than carrying a mysterious patch. If it causes crashes here, probably something else is broken somewhere without crashing....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052725</commentid>
    <comment_count>15</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-08-14 08:14:18 -0700</bug_when>
    <thetext>*** Bug 278090 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052749</commentid>
    <comment_count>16</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-08-14 09:06:10 -0700</bug_when>
    <thetext>*** Bug 278101 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052839</commentid>
    <comment_count>17</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-08-14 15:27:22 -0700</bug_when>
    <thetext>I have arrived to a smaller workaround/fix:

diff --git a/Source/WebCore/rendering/TextDecorationPainter.cpp b/Source/WebCore/rendering/TextDecorationPainter.cpp
index 5c4e798d7aef..6c3951145f30 100644
--- a/Source/WebCore/rendering/TextDecorationPainter.cpp
+++ b/Source/WebCore/rendering/TextDecorationPainter.cpp
@@ -141,7 +141,7 @@ static DashArray translateIntersectionPointsToSkipInkBoundaries(const DashArray&amp;
                 intermediateTuples.append(*i);
         }
     } else
-        intermediateTuples = tuples;
+        intermediateTuples.swap(tuples);
 
     // Step 3: Output the space between the ranges, but only if the space warrants an underline.
     float previous = 0;

What do we think about this? 🤪</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052956</commentid>
    <comment_count>18</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-08-15 00:27:30 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #17)
&gt; I have arrived to a smaller workaround/fix:
&gt; 
&gt; diff --git a/Source/WebCore/rendering/TextDecorationPainter.cpp
&gt; b/Source/WebCore/rendering/TextDecorationPainter.cpp
&gt; index 5c4e798d7aef..6c3951145f30 100644
&gt; --- a/Source/WebCore/rendering/TextDecorationPainter.cpp
&gt; +++ b/Source/WebCore/rendering/TextDecorationPainter.cpp
&gt; @@ -141,7 +141,7 @@ static DashArray
&gt; translateIntersectionPointsToSkipInkBoundaries(const DashArray&amp;
&gt;                  intermediateTuples.append(*i);
&gt;          }
&gt;      } else
&gt; -        intermediateTuples = tuples;
&gt; +        intermediateTuples.swap(tuples);
&gt;  
&gt;      // Step 3: Output the space between the ranges, but only if the space
&gt; warrants an underline.
&gt;      float previous = 0;
&gt; 
&gt; What do we think about this? 🤪

I have been dogfooding a build from yesterday with the above one-liner
applied and I have had no further crashes. That&apos;s good. Now, understanding
exactly why the fix works is the tricky part...

In bug #278090 we got a different (more complete?) backtrace, and it had
the frames at the top following:

  #0  memcpy () at /usr/include/bits/string_fortified.h:29
  #1  uninitializedCopy () at WTF/Headers/wtf/Vector.h:190
  #2  uninitializedCopy () at WTF/Headers/wtf/Vector.h:284
  #3  operator= () at WTF/Headers/wtf/Vector.h:1044
  #4  translateIntersectionPointsToSkipInkBoundaries () at /usr/src/debug/webkit2gtk-4.1/webkitgtk-2.44.3/Source/WebCore/rendering/TextDecorationPainter.cpp:144

Looking at the code, frame 4 is exactly at the line with the assignment
changed in my suggested change. The calls into uninitializedCopy() made me
think that there might be some issue with the initialization of either “tuples”
or “intermediateTuples”, and that going through the assignment operator if one
of the objects is in an odd state, in particular in regard to the values returned
by Vector::size() or the Vector buffer base pointer (both used a number of times
inside the assignment operator code), that could explain an OOB read or write in
the call to “memcpy()” where the crash ultimately happens. Or something gets
corrupted (?) during the process--I am not sure yet.

Noticing that “tuples” is not ever used in the rest of the function, and that some
print-debugging showed that it was in a consistent state, and “intermediateTuples”
as well, it seemed reasonable to use WTFMove() to replace the internal state of
one Vector with the other. Well, that did&apos;t work, but using Vector::swap() directly
did! IIUC the Vector::swap() function is used internally by the move assignment
operator so the change above is effectively doing the same but using a lower level
call... which puts less work on the compiler&apos;s inlining logic --which definitely
interacts with LTO!-- making it “easier” to either avoid triggering what I still
think is a compiler bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052981</commentid>
    <comment_count>19</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-08-15 03:47:10 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/32240</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053097</commentid>
    <comment_count>20</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-08-15 13:16:28 -0700</bug_when>
    <thetext>Committed 282306@main (96fb0b0c6c46): &lt;https://commits.webkit.org/282306@main&gt;

Reviewed commits have been landed. Closing PR #32240 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053098</commentid>
    <comment_count>21</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-08-15 13:17:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/133975304&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053268</commentid>
    <comment_count>22</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-08-16 03:46:12 -0700</bug_when>
    <thetext>*** Bug 277333 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>471541</attachid>
            <date>2024-05-29 07:19:23 -0700</date>
            <delta_ts>2024-05-29 07:19:23 -0700</delta_ts>
            <desc>test -fno-lto for TextDecorationPainter.cpp</desc>
            <filename>webkit-test.patch</filename>
            <type>text/plain</type>
            <size>995</size>
            <attacher name="Yanko Kaneti">yaneti</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NNYWtlTGlzdHMudHh0IGIvU291cmNlL1dlYkNv
cmUvQ01ha2VMaXN0cy50eHQKaW5kZXggNDczNjRmMmM3NWQzLi5lNzQ2YTIyMjgxZGYgMTAwNjQ0
Ci0tLSBhL1NvdXJjZS9XZWJDb3JlL0NNYWtlTGlzdHMudHh0CisrKyBiL1NvdXJjZS9XZWJDb3Jl
L0NNYWtlTGlzdHMudHh0CkBAIC05LDYgKzksMTAgQEAgbGlzdChBUFBFTkQgV2ViQ29yZV9VTklG
SUVEX1NPVVJDRV9MSVNUX0ZJTEVTCiAgICAgIlNvdXJjZXMudHh0IgogKQogCitsaXN0KEFQUEVO
RCBXZWJDb3JlX1NPVVJDRVMgcmVuZGVyaW5nL1RleHREZWNvcmF0aW9uUGFpbnRlci5jcHApCitz
ZXRfc291cmNlX2ZpbGVzX3Byb3BlcnRpZXMocmVuZGVyaW5nL1RleHREZWNvcmF0aW9uUGFpbnRl
ci5jcHAgUFJPUEVSVElFUyBDT01QSUxFX0ZMQUdTIC1mbm8tbHRvKQorCisKIHNldChXZWJDb3Jl
X1BSSVZBVEVfSU5DTFVERV9ESVJFQ1RPUklFUwogICAgICIke0NNQUtFX0JJTkFSWV9ESVJ9Igog
ICAgICIke1dlYkNvcmVfREVSSVZFRF9TT1VSQ0VTX0RJUn0iCmRpZmYgLS1naXQgYS9Tb3VyY2Uv
V2ViQ29yZS9Tb3VyY2VzLnR4dCBiL1NvdXJjZS9XZWJDb3JlL1NvdXJjZXMudHh0CmluZGV4IGYz
ZmY3OTg0ZjdmYS4uYmQ5NWQ2ZDg4MjY0IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29yZS9Tb3Vy
Y2VzLnR4dAorKysgYi9Tb3VyY2UvV2ViQ29yZS9Tb3VyY2VzLnR4dApAQCAtMjc0Myw3ICsyNzQz
LDYgQEAgcmVuZGVyaW5nL1JlbmRlcldpZGdldC5jcHAKIHJlbmRlcmluZy9TdHlsZWRNYXJrZWRU
ZXh0LmNwcAogcmVuZGVyaW5nL1RhYmxlTGF5b3V0LmNwcAogcmVuZGVyaW5nL1RleHRCb3hQYWlu
dGVyLmNwcAotcmVuZGVyaW5nL1RleHREZWNvcmF0aW9uUGFpbnRlci5jcHAKIHJlbmRlcmluZy9U
ZXh0UGFpbnRTdHlsZS5jcHAKIHJlbmRlcmluZy9UZXh0UGFpbnRlci5jcHAKIHJlbmRlcmluZy9U
cmFuc2Zvcm1PcGVyYXRpb25EYXRhLmNwcAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>