From 6d7cd31feec58011a593cf732274a33dcc1bcb53 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 16 Jun 2020 09:54:20 -0300 Subject: Fixed missing GC barriers in compiler and undump While building a new prototype, the GC needs barriers for every object (strings and nested prototypes) that is attached to the new prototype. --- lparser.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index 37102b72..bc7d9a4f 100644 --- a/lparser.c +++ b/lparser.c @@ -737,6 +737,7 @@ static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { fs->firstlabel = ls->dyd->label.n; fs->bl = NULL; f->source = ls->source; + luaC_objbarrier(ls->L, f, f->source); f->maxstacksize = 2; /* registers 0/1 are always valid */ enterblock(fs, bl, 0); } @@ -1959,6 +1960,7 @@ static void mainfunc (LexState *ls, FuncState *fs) { env->idx = 0; env->kind = VDKREG; env->name = ls->envn; + luaC_objbarrier(ls->L, fs->f, env->name); luaX_next(ls); /* read first token */ statlist(ls); /* parse main body */ check(ls, TK_EOS); @@ -1977,6 +1979,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, sethvalue2s(L, L->top, lexstate.h); /* anchor it */ luaD_inctop(L); funcstate.f = cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ luaC_objbarrier(L, funcstate.f, funcstate.f->source); lexstate.buff = buff; -- cgit v1.2.3-55-g6feb