1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
From: Ismael Luceno <ismael@iodev.co.uk>
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.
---
src/con_x11.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/src/con_x11.cpp
+++ b/src/con_x11.cpp
@@ -897,8 +897,8 @@
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;
|