From 0b989de55f65c8b11e4e577136cb2ac66b642674 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sat, 22 Oct 2022 18:22:00 +0200 Subject: [PATCH] - [FIX] overflow in setpal --- lua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua.cpp b/lua.cpp index 0cb5c6d..b3f7443 100644 --- a/lua.cpp +++ b/lua.cpp @@ -80,7 +80,7 @@ extern "C" { int r,g,b; if (lua_istable(L, -1)) { uint32_t pal[256]; - const int len = lua_rawlen(L, -1); + const int len = SDL_min(256, lua_rawlen(L, -1)); for (int i=1;i<=len;++i) { lua_rawgeti(L, -1, i); lua_getfield(L, -1, "r");