aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-30 15:36:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-30 15:36:26 -0300
commit422ce50d2e8856ed789d1359c673122dbb0088ea (patch)
tree163c566c322915b12d13e4b1d1966d5658e19086 /lapi.c
parentc33b1728aeb7dfeec4013562660e07d32697aa6b (diff)
downloadlua-422ce50d2e8856ed789d1359c673122dbb0088ea.tar.gz
lua-422ce50d2e8856ed789d1359c673122dbb0088ea.tar.bz2
lua-422ce50d2e8856ed789d1359c673122dbb0088ea.zip
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.
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c1
1 files changed, 1 insertions, 0 deletions
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) {
563 while (n--) { 563 while (n--) {
564 setobj2n(L, &cl->upvalue[n], s2v(L->top + n)); 564 setobj2n(L, &cl->upvalue[n], s2v(L->top + n));
565 /* does not need barrier because closure is white */ 565 /* does not need barrier because closure is white */
566 lua_assert(iswhite(cl));
566 } 567 }
567 setclCvalue(L, s2v(L->top), cl); 568 setclCvalue(L, s2v(L->top), cl);
568 api_incr_top(L); 569 api_incr_top(L);