From 21b1c449de2940a9890b53f4898ec8832566e9b4 Mon Sep 17 00:00:00 2001 From: hong Date: Sat, 21 Sep 2019 14:51:49 +0800 Subject: [PATCH] luaH_set check shared table --- 3rd/lua/ltable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/3rd/lua/ltable.c b/3rd/lua/ltable.c index ea4fe7fc..7c909bda 100644 --- a/3rd/lua/ltable.c +++ b/3rd/lua/ltable.c @@ -608,7 +608,10 @@ const TValue *luaH_get (Table *t, const TValue *key) { ** barrier and invalidate the TM cache. */ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { - const TValue *p = luaH_get(t, key); + const TValue *p; + if(isshared(t)) + luaG_runerror(L,"attempt to change a shared table"); + p = luaH_get(t, key); if (p != luaO_nilobject) return cast(TValue *, p); else return luaH_newkey(L, t, key);