Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow registry to be set to readonly #184

Merged
merged 4 commits into from
Nov 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions VM/src/lapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ldo.h"
#include "lvm.h"
#include "lnumutils.h"
#include "ldebug.h"
LoganDark marked this conversation as resolved.
Show resolved Hide resolved

#include <string.h>

Expand Down Expand Up @@ -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)))
LoganDark marked this conversation as resolved.
Show resolved Hide resolved
luaG_runerror(L, "Attempt to set the registry to readonly");
t->readonly = value;
return;
}
Expand Down