From ddc6ae749188c4df1c5ca67ff3e77a1abbb27e29 Mon Sep 17 00:00:00 2001 From: LoganDark Date: Mon, 8 Nov 2021 12:11:00 -0800 Subject: [PATCH] Don't allow registry to be set to readonly --- VM/src/lapi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/VM/src/lapi.cpp b/VM/src/lapi.cpp index f2e97c66..687d5b55 100644 --- a/VM/src/lapi.cpp +++ b/VM/src/lapi.cpp @@ -10,6 +10,7 @@ #include "ldo.h" #include "lvm.h" #include "lnumutils.h" +#include "ldebug.h" #include @@ -703,6 +704,8 @@ void lua_setreadonly(lua_State* L, int objindex, bool value) const TValue* o = index2adr(L, objindex); api_check(L, ttistable(o)); Table* t = hvalue(o); + if (value && obj2gco(t) == gcvalue(registry(L))) + luaG_runerror(L, "Attempt to set the registry to readonly"); t->readonly = value; return; }