diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-03-13 15:30:52 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-03-13 15:30:52 -0300 |
| commit | 22974326ca0d4f893849ce722cc1d65b3e228f42 (patch) | |
| tree | 1b4cb2cad1c55edce63e9fe6e468b1833950397d /lapi.c | |
| parent | c931d86e98da320c71da70c16d44aa28e9755520 (diff) | |
| download | lua-22974326ca0d4f893849ce722cc1d65b3e228f42.tar.gz lua-22974326ca0d4f893849ce722cc1d65b3e228f42.tar.bz2 lua-22974326ca0d4f893849ce722cc1d65b3e228f42.zip | |
Use after free in 'luaV_finishset'
If a metatable is a weak table, its __newindex field could be collected
by an emergency collection while being used in 'luaV_finishset'. (This
bug has similarities with bug 5.3.2-1, fixed in commit a272fa66.)
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 5 |
1 files changed, 5 insertions, 0 deletions
| @@ -681,6 +681,11 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) { | |||
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | 683 | ||
| 684 | /* | ||
| 685 | ** The following function assumes that the registry cannot be a weak | ||
| 686 | ** table, so that en mergency collection while using the global table | ||
| 687 | ** cannot collect it. | ||
| 688 | */ | ||
| 684 | static void getGlobalTable (lua_State *L, TValue *gt) { | 689 | static void getGlobalTable (lua_State *L, TValue *gt) { |
| 685 | Table *registry = hvalue(&G(L)->l_registry); | 690 | Table *registry = hvalue(&G(L)->l_registry); |
| 686 | lu_byte tag = luaH_getint(registry, LUA_RIDX_GLOBALS, gt); | 691 | lu_byte tag = luaH_getint(registry, LUA_RIDX_GLOBALS, gt); |
