Correct anchoring and GC barriers in 'loadString'

Call to 'luaH_setint' could call the GC with the string unanchored.
Moreover, previously saved strings were being assigned to the prototype
without a barrier.
This commit is contained in:
Roberto Ierusalimschy
2023-11-13 13:11:09 -03:00
parent 3b57e37e48
commit eabf425c76
2 changed files with 37 additions and 42 deletions

View File

@@ -144,7 +144,7 @@ static void dumpCode (DumpState *D, const Proto *f) {
}
static void dumpFunction(DumpState *D, const Proto *f);
static void dumpFunction (DumpState *D, const Proto *f);
static void dumpConstants (DumpState *D, const Proto *f) {
int i;
@@ -218,10 +218,6 @@ static void dumpDebug (DumpState *D, const Proto *f) {
static void dumpFunction (DumpState *D, const Proto *f) {
if (D->strip)
dumpString(D, NULL); /* no debug info */
else
dumpString(D, f->source);
dumpInt(D, f->linedefined);
dumpInt(D, f->lastlinedefined);
dumpByte(D, f->numparams);
@@ -231,6 +227,7 @@ static void dumpFunction (DumpState *D, const Proto *f) {
dumpConstants(D, f);
dumpUpvalues(D, f);
dumpProtos(D, f);
dumpString(D, D->strip ? NULL : f->source);
dumpDebug(D, f);
}