- [FIX] overflow in setpal

This commit is contained in:
2022-10-22 18:22:00 +02:00
parent 4ff4e6fa78
commit 0b989de55f

View File

@@ -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");