From bafedf8376dbdda64360a630055291a4e9840524 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 12:41:03 +0530 Subject: [PATCH] Make the scale sanitization more comprehensive --- kitty/glfw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kitty/glfw.c b/kitty/glfw.c index 142075e86..b83c20f3a 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -386,9 +386,9 @@ get_window_content_scale(GLFWwindow *w, float *xscale, float *yscale, double *xd GLFWmonitor *monitor = glfwGetPrimaryMonitor(); if (monitor) glfwGetMonitorContentScale(monitor, xscale, yscale); } - // check for zero or NaN values of xscale/yscale - if (!*xscale || *xscale != *xscale) *xscale = 1.0; - if (!*yscale || *yscale != *yscale) *yscale = 1.0; + // check for zero, negative, NaN or excessive values of xscale/yscale + if (*xscale <= 0 || *xscale != *xscale || *xscale >= 24) *xscale = 1.0; + if (*yscale <= 0 || *yscale != *yscale || *yscale >= 24) *yscale = 1.0; #ifdef __APPLE__ const double factor = 72.0; #else