mirror of https://github.com/rusefi/lua.git
Bug fix: emergency collection while loading upvalues
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.
This commit is contained in:
parent
454424690d
commit
e398e03aa9
|
@ -205,8 +205,9 @@ static void loadUpvalues (LoadState *S, Proto *f) {
|
||||||
n = loadInt(S);
|
n = loadInt(S);
|
||||||
f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc);
|
f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc);
|
||||||
f->sizeupvalues = n;
|
f->sizeupvalues = n;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++)
|
||||||
f->upvalues[i].name = NULL;
|
f->upvalues[i].name = NULL;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
f->upvalues[i].instack = loadByte(S);
|
f->upvalues[i].instack = loadByte(S);
|
||||||
f->upvalues[i].idx = loadByte(S);
|
f->upvalues[i].idx = loadByte(S);
|
||||||
f->upvalues[i].kind = loadByte(S);
|
f->upvalues[i].kind = loadByte(S);
|
||||||
|
|
Loading…
Reference in New Issue