From bbb73fe64e32ddaea6d04aeb69cc5cfa9a295806 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 12 Oct 2018 23:15:41 +0100 Subject: [PATCH] Fix integer overflow `x + wid` will convert x to unsigned first, if x < 0, integer overflow could occur. --- src/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.h b/src/common.h index b07914f7..7778c743 100644 --- a/src/common.h +++ b/src/common.h @@ -1838,10 +1838,10 @@ free_fence(session_t *ps, XSyncFence *pfence) { * Check if a rectangle includes the whole screen. */ static inline bool -rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) { +rect_is_fullscreen(session_t *ps, int x, int y, int wid, int hei) { return (x <= 0 && y <= 0 && - (x + wid) >= (unsigned int)ps->root_width && - (y + hei) >= (unsigned int)ps->root_height); + (x + wid) >= ps->root_width && + (y + hei) >= ps->root_height); } static void