From 55d0502394d00aa14fcfb40e4a9d2e09b30b73e9 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 be16b1dff..837452771 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -3791,7 +3791,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++) { @@ -3811,7 +3811,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