<?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>282172</bug_id>
          
          <creation_ts>2024-10-28 08:32:19 -0700</creation_ts>
          <short_desc>[GTK] [2.46.2] WebCore::DisplayUpdate::nextUpdate(): Arithmetic exception on i386</short_desc>
          <delta_ts>2026-03-17 02:27:46 -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>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085710</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alberto Garcia">berto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ajv-691-701-2657</cc>
    
    <cc>anjana.r</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>givemeagoodun</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2070910</commentid>
    <comment_count>0</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-10-28 08:32:19 -0700</bug_when>
    <thetext>One Debian user reports the following crash using WebKitGTK 2.46.0 and 2.46.2 in i386 when running Evolution 3.54.0 on Debian trixie:

Thread 48 &quot;VBlankMonitor&quot; received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0xccc7bb40 (LWP 21804)]
Download failed: Argument invalide.  Continuing without source file ./build-soup3/./build-soup3/WebCore/PrivateHeaders/WebCore/DisplayUpdate.h.
WebCore::DisplayUpdate::nextUpdate () at ./build-soup3/WebCore/PrivateHeaders/WebCore/DisplayUpdate.h:44
warning: 44	./build-soup3/WebCore/PrivateHeaders/WebCore/DisplayUpdate.h: Aucun fichier ou dossier de ce nom
#0  WebCore::DisplayUpdate::nextUpdate () at ./build-soup3/WebCore/PrivateHeaders/WebCore/DisplayUpdate.h:44
#1  WebKit::DisplayLink::notifyObserversDisplayDidRefresh () at ./Source/WebKit/UIProcess/DisplayLink.cpp:217
#2  0xf1f734db in operator() () at ./Source/WebKit/UIProcess/glib/DisplayLinkGLib.cpp:38
#3  call () at ./build-soup3/WTF/Headers/wtf/Function.h:53
#4  0xf1f73bbc in WTF::Function&lt;void()&gt;::operator() () at ./build-soup3/WTF/Headers/wtf/Function.h:82
#5  operator() () at ./Source/WebKit/UIProcess/glib/DisplayVBlankMonitor.cpp:101
#6  call () at ./build-soup3/WTF/Headers/wtf/Function.h:53
#7  0xeeca1d20 in WTF::Function&lt;void()&gt;::operator() () at ./Source/WTF/wtf/Function.h:82
#8  WTF::Thread::entryPoint () at ./Source/WTF/wtf/Threading.cpp:266
#9  0xeed0a9f8 in wtfThreadEntryPoint () at ./Source/WTF/wtf/posix/ThreadingPOSIX.cpp:239
#10 0xf0dda872 in start_thread (arg=&lt;optimized out&gt;) at ./nptl/pthread_create.c:447
#11 0xf0e72b48 in __GI___clone3 () at ../sysdeps/unix/sysv/linux/i386/clone3.S:111

From the line numbers the problem seems to be here: https://github.com/WebKit/WebKit/blob/webkitgtk-2.46.2/Source/WebCore/platform/graphics/DisplayUpdate.h#L44

And that is likely a division by zero:

    DisplayUpdate nextUpdate() const
    {
        return { (updateIndex + 1) % updatesPerSecond, updatesPerSecond };
    }

The CPU is an Intel Core2 Duo T9300</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087286</commentid>
    <comment_count>1</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2025-01-14 16:50:11 -0800</bug_when>
    <thetext>I can confirm this SIGFPE on the VBlankMonitor thread.  It happens on an Atom N270 (32-bit Debian/Devuan) with libwebkit2gtk-4.0-37

I don&apos;t see debug symbols in the repo, but happy to work with somebody.

This happens on the Vala-based Midori browser, right after initial screen paint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087828</commentid>
    <comment_count>2</comment_count>
    <who name="efilson28@gmail.com">givemeagoodun</who>
    <bug_when>2025-01-16 12:38:42 -0800</bug_when>
    <thetext>Can also confirm on Atom N270 on Debian (libwebkit2gtk-4.1, version 2.46.5), using any application that uses webkitgtk, I&apos;m currently working on getting it to compile to make debug symbols for it (I keep running out of virtual memory space though)

Based on the fact that it happens in VBlankMonitor, it might be worthwhile to note that I&apos;m using xserver-xorg 1.21.1.15 according to X -version, using the mesa gallium i915 driver.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088136</commentid>
    <comment_count>3</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2025-01-17 13:48:30 -0800</bug_when>
    <thetext>(In reply to Alberto Garcia from comment #0)
&gt; ...
&gt; From the line numbers the problem seems to be here:
&gt; https://github.com/WebKit/WebKit/blob/webkitgtk-2.46.2/Source/WebCore/
&gt; platform/graphics/DisplayUpdate.h#L44
&gt; 
&gt; And that is likely a division by zero:
&gt; 
&gt;     DisplayUpdate nextUpdate() const
&gt;     {
&gt;         return { (updateIndex + 1) % updatesPerSecond, updatesPerSecond };
&gt;     }
&gt; 
&gt; The CPU is an Intel Core2 Duo T9300

The code at the SIGFPE doesn&apos;t clearly match that function:

(gdb) x/6i $pc
=&gt; 0xb27c03d8:  divl   0x18(%ebx)
   0xb27c03db:  mov    %edx,0x14(%ebx)
   0xb27c03de:  test   %cl,%cl
   0xb27c03e0:  je     0xb27c0430
   0xb27c03e2:  mov    0x30(%esp),%eax
   0xb27c03e6:  movl   $0x0,0x1c(%eax)
(gdb) x/16xw $ebx
0x8405e0:       0x004d56e0      0x00000001      0x008b3cb0      0x00000001
0x8405f0:       0x00000000      0x00000000      0x00000000      0x00000000
0x840600:       0xb1ef0830      0x00000000      0xb1ef0234      0x00000031
0x840610:       0x00000000      0x00000000      0x00000000      0xb7caec70
(gdb) Quit

It&apos;s putting the modulo back into the structure from which it got the 0 value for the SIGFPE.

Andy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115612</commentid>
    <comment_count>4</comment_count>
    <who name="Anjana">anjana.r</who>
    <bug_when>2025-05-07 04:13:05 -0700</bug_when>
    <thetext>Hello All,

Any update on this bug?

I am also facing a similar issue. I have Debian Bookworm installed on my PC which is intel i3 Core.

I am trying to execute the &quot;MiniBrowser&quot; Application.

The application is crashing with Floating Point exception.

Upon further debugging, I have observed that the issue is coming because &quot;updatesPerSecond&quot; is 0 in the function &quot;nextUpdate() &quot;


Any reason why this is happening?

Thanks &amp; Regards,
Anjana</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190444</commentid>
    <comment_count>5</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2026-03-15 17:05:50 -0700</bug_when>
    <thetext>So I hunted this down; a 32-bit overflow bug in Gtk, now reported:

https://gitlab.gnome.org/GNOME/gtk/-/issues/8103</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190526</commentid>
    <comment_count>6</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2026-03-16 04:00:12 -0700</bug_when>
    <thetext>Thanks, I prepared some patched GTK packages for Debian trixie users to test, I&apos;ll come back with the results:

https://people.debian.org/~berto/bug-1085710/trixie/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190573</commentid>
    <comment_count>7</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2026-03-16 07:45:31 -0700</bug_when>
    <thetext>The Gtk side is asking about a Merge Request.  Does this mean you&apos;ll handle that as well?  You might want to tack something onto the bug over there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190578</commentid>
    <comment_count>8</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2026-03-16 07:56:19 -0700</bug_when>
    <thetext>At the moment I&apos;m just testing if this solves the problem or not, but I can help with the merge request if necessary.

Since you have been able to reproduce it, I understand that the bug is in this line:

refresh_rate = (1000 * xmode-&gt;dotClock) / (xmode-&gt;hTotal * xmode-&gt;vTotal);

From your analysis it should be enough with replacing that 1000 with 1000ULL, right?

What are the values of dotClock, hTotal and vTotal that are causing the overflow?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190581</commentid>
    <comment_count>9</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2026-03-16 08:00:08 -0700</bug_when>
    <thetext>It&apos;s in the gdb log over on that ticket:

(gdb) p *xmode
$23 = {id = 73, width = 1440, height = 900, dotClock = 106500000,
  hSyncStart = 1520, hSyncEnd = 1672, hTotal = 1904, hSkew = 0,
  vSyncStart = 903, vSyncEnd = 909, vTotal = 934, name = 0xccb158 &quot;1440x900&quot;,
  nameLength = 8, modeFlags = 6}

Along with the calculation with and without forcing to 64 bits.

(Unsurprising values for a low end desktop config.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190586</commentid>
    <comment_count>10</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2026-03-16 08:05:04 -0700</bug_when>
    <thetext>Thanks, then using 1000ULL should be enough. I&apos;m preparing some patches packages for testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190661</commentid>
    <comment_count>11</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2026-03-16 12:00:15 -0700</bug_when>
    <thetext>Andy: the Debian reporter confirms that this fixes the crash in WebKit, will you create a MR against GTK or do you need help with that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190670</commentid>
    <comment_count>12</comment_count>
    <who name="Andy Valencia">ajv-691-701-2657</who>
    <bug_when>2026-03-16 12:57:13 -0700</bug_when>
    <thetext>I would be happy to create the MR, but never having done it--yes, help would be welcome.  I will get in touch via private email, thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190929</commentid>
    <comment_count>13</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2026-03-17 02:27:46 -0700</bug_when>
    <thetext>Ok, this was fixed in GTK so we can close it.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>