From db700f9be1ee7c9e9e7febe337cdb207f9ef34a2 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 22 Oct 2018 15:38:45 +0100 Subject: [PATCH] Fix OOB when the number of screens change --- src/compton.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compton.c b/src/compton.c index 25ebb53..dd45bac 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1778,7 +1778,13 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co pixman_region32_subtract(®_tmp, ®_tmp, &bshape); #ifdef CONFIG_XINERAMA - if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0) + if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0 && + w->xinerama_scr < ps->xinerama_nscrs) + // There can be a window where number of screens is updated, + // but the screen number attached to the windows have not. + // + // Window screen number will be updated eventually, so here we + // just check to make sure we don't access out of bounds. pixman_region32_intersect(®_tmp, ®_tmp, &ps->xinerama_scr_regs[w->xinerama_scr]); #endif