check texInfo so mods can't spoof it in smlua_to_texture_info
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

This commit is contained in:
Isaac0-dev 2025-06-06 09:34:23 +10:00
parent 73db1b0345
commit b99f18dacc

View file

@ -270,21 +270,15 @@ struct TextureInfo *smlua_to_texture_info(lua_State *L, int index) {
lua_pushstring(L, "texture");
lua_gettable(L, top + 1);
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
const u8 *texPtr = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
lua_pop(L, 1);
if (!gSmLuaConvertSuccess) { return NULL; }
tmpTexInfo.bitSize = smlua_get_integer_field(top + 1, "bitSize");
if (!gSmLuaConvertSuccess) { return NULL; }
tmpTexInfo.width = smlua_get_integer_field(top + 1, "width");
if (!gSmLuaConvertSuccess) { return NULL; }
tmpTexInfo.height = smlua_get_integer_field(top + 1, "height");
if (!gSmLuaConvertSuccess) { return NULL; }
tmpTexInfo.name = smlua_get_string_field(top + 1, "name");
if (!gSmLuaConvertSuccess) { return NULL; }
// Get the texInfo from DynOS so mods can't spoof it
if (!texPtr || !dynos_texture_get_from_data(texPtr, texInfo)) {
gSmLuaConvertSuccess = false;
return NULL;
}
lua_settop(L, top);
}