#1131016 gtk+3.0: refresh_rate calculation overflows on 32-bit targets

Package:
src:gtk+3.0
Source:
src:gtk+3.0
Submitter:
Alberto Garcia
Date:
2026-03-18 12:19:01 UTC
Severity:
normal
Tags:
#1131016#5
Date:
2026-03-17 00:02:06 UTC
From:
To:
Hi,

gdk_monitor_get_refresh_rate() overflows on 32-bit systems, returning
a bogus value. This has been confirmed to crash webkitgtk-based apps
(#1085710).

The problem is in this line from gdk/x11/gdkscreen-x11.c (there are
actually two of them in the file):

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

xmode->dotClock is an unsigned long (32 bits in i386) so a pixel clock
of e.g. 106500000 will result in an overflow.

I confirmed that using 1000ULL instead of 1000 solves the crash (patch
attached), but in case you prefer to wait for the upstream fix, here's
the issue:

https://gitlab.gnome.org/GNOME/gtk/-/issues/8103

Regards,

Berto

#1131016#14
Date:
2026-03-18 12:16:15 UTC
From:
To:
Control: tags -1 fixed-upstream

FYI this has been fixed upstream, in both GTK3 and GTK4 (both patches
are identical):

https://gitlab.gnome.org/GNOME/gtk/-/commit/05fc3f45bf10f6691675857a5619a35f7193057f

https://gitlab.gnome.org/GNOME/gtk/-/commit/f0f9cdddfaee53aff42b9300da1bffdf98454b65

Berto