[gtk: 1/2] gdk/win32: fix integer overflow in monitor refresh rate calculation




commit 7190a31b5f19947011806a22d7ae4641a7fbad8d
Author: Volker RĂ¼melin <volker ruemelin t-online de>
Date:   Mon Nov 23 21:34:01 2020 +0100

    gdk/win32: fix integer overflow in monitor refresh rate calculation
    
    In gdk/win32/gdkmonitor-win32.c in function
    populate_monitor_devices_from_display_config() refresh->Numerator * 1000
    overflows for refresh->Numerator > 4294976.
    
    Cast the factor 1000 to UINT64 to prevent the overflow.
    
    Fixes #3394

 gdk/win32/gdkmonitor-win32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gdk/win32/gdkmonitor-win32.c b/gdk/win32/gdkmonitor-win32.c
index 0f02bef14f..b149a33b63 100644
--- a/gdk/win32/gdkmonitor-win32.c
+++ b/gdk/win32/gdkmonitor-win32.c
@@ -509,7 +509,7 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
 
       refresh = &dispconf_paths[path_index].targetInfo.refreshRate;
       gdk_monitor_set_refresh_rate (mon,
-                                    refresh->Numerator * 1000 / refresh->Denominator);
+                                    refresh->Numerator * (UINT64) 1000 / refresh->Denominator);
     }
 
   g_free (dispconf_paths);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]