From 27c7054505ebf659319bea12892e7190e01b70c6 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 21 Dec 2021 10:47:55 +1100 Subject: [PATCH] [client] x11: protect against msc overflow with jitRender --- client/displayservers/X11/x11.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/displayservers/X11/x11.c b/client/displayservers/X11/x11.c index 7de18334..956a2db5 100644 --- a/client/displayservers/X11/x11.c +++ b/client/displayservers/X11/x11.c @@ -117,7 +117,16 @@ static void x11DoPresent(uint64_t msc) uint64_t refill; if (!first) - refill = 50 - (lastMsc - msc); + { + const uint64_t delta = (lastMsc >= msc) ? + lastMsc - msc : + ~0ULL - msc + lastMsc; + + if (delta > 50) + return; + + refill = 50 - delta; + } else { refill = 50;