From 7d91d06ce0381eaed317ea12d9b50d8ad9316403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 14 Sep 2025 22:45:35 +0200 Subject: [PATCH] Fix crash on OS X on resolutions that are not multiples of 32 --- src/v_video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index e9404d391..15eb653ab 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -3788,7 +3788,7 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b) void V_Init(void) { INT32 i; - const INT32 screensize = vid.rowbytes * vid.height; + INT32 screensize = vid.rowbytes * vid.height; for (i = 0; i < NUMSCREENS; i++) { @@ -3808,7 +3808,9 @@ void V_Init(void) // we need to allocate these relative to their cpu restrictions to not trigger segfaults // TODO: add support for sve and neon #if defined(__SSE__) - vid.screens[i] = aligned_alloc(128, screensize); + while (screensize & 15) + screensize++; + vid.screens[i] = aligned_alloc(16, screensize); #else vid.screens[i] = malloc(screensize); #endif