From 422ce50d2e8856ed789d1359c673122dbb0088ea Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 30 Jun 2020 15:36:26 -0300 Subject: Fixed detail in 'loadUpvalues' In 'lundump.c', when loading the upvalues of a function, there can be a read error if the chunk is truncated. In that case, the creation of the error message can trigger an emergency collection while the prototype is still anchored. So, the prototype must be GC consistent before loading the upvales, which implies that it the 'name' fields must be filled with NULL before the reading. --- lapi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 3e24781e..184b8dd7 100644 --- a/lapi.c +++ b/lapi.c @@ -563,6 +563,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { while (n--) { setobj2n(L, &cl->upvalue[n], s2v(L->top + n)); /* does not need barrier because closure is white */ + lua_assert(iswhite(cl)); } setclCvalue(L, s2v(L->top), cl); api_incr_top(L); -- cgit v1.2.3-55-g6feb