mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Don't allow registry to be set to readonly
This commit is contained in:
parent
f1649a43cd
commit
ddc6ae7491
1 changed files with 3 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "ldo.h"
|
#include "ldo.h"
|
||||||
#include "lvm.h"
|
#include "lvm.h"
|
||||||
#include "lnumutils.h"
|
#include "lnumutils.h"
|
||||||
|
#include "ldebug.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -703,6 +704,8 @@ void lua_setreadonly(lua_State* L, int objindex, bool value)
|
||||||
const TValue* o = index2adr(L, objindex);
|
const TValue* o = index2adr(L, objindex);
|
||||||
api_check(L, ttistable(o));
|
api_check(L, ttistable(o));
|
||||||
Table* t = hvalue(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;
|
t->readonly = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue