From b8239abdf86f251d75567381d0d59976f9d91efd Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 9 Sep 2020 15:54:21 -0400 Subject: [PATCH] glx: Reject glXSwapIntervalMESA greater than INT_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It wouldn't work in any case, as the internal API only stores a signed int, and GLX_EXT_swap_control_tear will overload the meaning of negative values so we should avoid ambiguity. If your application needs a swap interval in excess of ~414.25 days, I'm very sorry. Reviewed-by: Michel Dänzer Part-of: --- src/glx/glxcmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 60b1e86d206..fb840eb6b7f 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -51,7 +51,7 @@ #endif /* GLX_USE_WINDOWSGL */ #endif #endif - +#include #include #include #include @@ -1796,6 +1796,9 @@ glXSwapIntervalMESA(unsigned int interval) #ifdef GLX_DIRECT_RENDERING struct glx_context *gc = __glXGetCurrentContext(); + if (interval > INT_MAX) + return GLX_BAD_VALUE; + if (gc != &dummyContext && gc->isDirect) { struct glx_screen *psc;