From cc0f8d0dc42c684580a0572900e483170b3a9b91 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 20 Nov 2023 14:34:50 -0300 Subject: [PATCH] [lua] Fix crash calling io.open() without argument (fix #4159) --- src/app/script/security.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/script/security.cpp b/src/app/script/security.cpp index eb3f9fd56..3e30ebc2e 100644 --- a/src/app/script/security.cpp +++ b/src/app/script/security.cpp @@ -73,7 +73,7 @@ int secure_io_open(lua_State* L) { int n = lua_gettop(L); - std::string absFilename = base::get_absolute_path(lua_tostring(L, 1)); + std::string absFilename = base::get_absolute_path(luaL_checkstring(L, 1)); FileAccessMode mode = FileAccessMode::Read; // Read is the default access if (lua_tostring(L, 2) &&