Fix integer overflow

`x + wid` will convert x to unsigned first, if x < 0, integer overflow
could occur.
This commit is contained in:
Yuxuan Shui 2018-10-12 23:15:41 +01:00
parent de6e2f5792
commit bbb73fe64e
1 changed files with 3 additions and 3 deletions

View File

@ -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