From b9e4293c01345abb489369c1a274374627908916 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 29 Jul 2022 22:15:12 +0200 Subject: [PATCH] con_x11: Make compatible with tiling window managers Tiling window managers can force the window size to be larger than supported, causing either an early abort at ConSetSize, or if compiled with NDEBUG, a segmentation fault down the road. Instead, just cap X and Y to their maximums. The only consequence is that the window is not fully utilised. Upstream-Status: Accepted [https://github.com/lanurmi/efte/pull/110] Signed-off-by: Ismael Luceno --- src/con_x11.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/con_x11.cpp b/src/con_x11.cpp index 95c53e8c562d..8460b879db3e 100644 --- a/src/con_x11.cpp +++ b/src/con_x11.cpp @@ -898,8 +898,8 @@ int ConSetSize(int X, int Y) { int i; int MX, MY; - assert(X <= ConMaxCols); - assert(Y <= ConMaxRows); + if (X > ConMaxCols) X = ConMaxCols; + if (Y > ConMaxRows) Y = ConMaxRows; p = NewBuffer = (unsigned char *) malloc(X * Y * 2); if (NewBuffer == NULL) return -1; -- 2.36.0 .