aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2019-06-25 21:18:08 +0200
committerSmallJoker <mk939@ymail.com>2019-09-14 19:42:25 +0200
commit23677be951b4dc2b9cc174ceb92f0e0b8e8eb867 (patch)
tree87e8a9bee105bbe77d964e109d0cefd1102f07e7 /src/script/cpp_api
parent720aedb46740ba203b4a0f3e049e368abc4932b3 (diff)
downloadminetest-23677be951b4dc2b9cc174ceb92f0e0b8e8eb867.tar.gz
minetest-23677be951b4dc2b9cc174ceb92f0e0b8e8eb867.tar.bz2
minetest-23677be951b4dc2b9cc174ceb92f0e0b8e8eb867.zip
Load CSM environment after the restrictions are known
Safety-guards for CSM callbacks to abort on a bad implementation Only run callbacks when the mods are loaded (and with it: builtin) Duplication checks inside constructors
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r--src/script/cpp_api/s_base.cpp7
-rw-r--r--src/script/cpp_api/s_security.cpp1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index e73f613ce..caa335d76 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -232,6 +232,13 @@ void ScriptApiBase::loadModFromMemory(const std::string &mod_name)
void ScriptApiBase::runCallbacksRaw(int nargs,
RunCallbacksMode mode, const char *fxn)
{
+#ifndef SERVER
+ // Hard fail for bad guarded callbacks
+ // Only run callbacks when the scripting enviroment is loaded
+ FATAL_ERROR_IF(m_type == ScriptingType::Client &&
+ !getClient()->modsLoaded(), fxn);
+#endif
+
#ifdef SCRIPTAPI_LOCK_DEBUG
assert(m_lock_recursion_count > 0);
#endif
diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp
index 876c7761a..d972be980 100644
--- a/src/script/cpp_api/s_security.cpp
+++ b/src/script/cpp_api/s_security.cpp
@@ -264,6 +264,7 @@ void ScriptApiSecurity::initializeSecurityClient()
};
static const char *debug_whitelist[] = {
"getinfo",
+ "traceback"
};
#if USE_LUAJIT