From 21f273ecc7926e1432776e828f2d769ea25a0cfa Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 4 Dec 2023 20:15:42 -0800
Subject: [PATCH] Fixed warning C6255: _alloca indicates failure by raising a
stack overflow exception. Consider using _malloca instead.
---
src/SDL_internal.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/SDL_internal.h b/src/SDL_internal.h
index 8c5463a924fb..23a836a8395e 100644
--- a/src/SDL_internal.h
+++ b/src/SDL_internal.h
@@ -44,6 +44,9 @@
#define HAVE_GCC_DIAGNOSTIC_PRAGMA 1
#endif
+#ifdef _MSC_VER // SDL_MAX_SMALL_ALLOC_STACKSIZE is smaller than _ALLOCA_S_THRESHOLD and should be generally safe
+#pragma warning(disable : 6255)
+#endif
#define SDL_MAX_SMALL_ALLOC_STACKSIZE 128
#define SDL_small_alloc(type, count, pisstack) ((*(pisstack) = ((sizeof(type) * (count)) < SDL_MAX_SMALL_ALLOC_STACKSIZE)), (*(pisstack) ? SDL_stack_alloc(type, count) : (type *)SDL_malloc(sizeof(type) * (count))))
#define SDL_small_free(ptr, isstack) \