From eabe2b5bb864a47cacff225ef5ba6e21ff6b43ef Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 17 Dec 2018 00:45:13 +0000 Subject: [PATCH] Explicitly cast X sequence number Fix an undefined behavior. Signed-off-by: Yuxuan Shui --- src/compton.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compton.c b/src/compton.c index bdbaf5b..d8a55c5 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1936,7 +1936,9 @@ ev_handle(session_t *ps, xcb_generic_event_t *ev) { // proc might also just be Xlib internal event processing functions, and // because they probably won't see all X replies, they will complain about // missing sequence numbers. - ev->sequence = LastKnownRequestProcessed(ps->dpy); + // + // We only need the low 16 bits + ev->sequence = (uint16_t)(LastKnownRequestProcessed(ps->dpy) & 0xffff); proc(ps->dpy, &dummy, (xEvent *)ev); }