diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-13 13:11:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-13 13:11:09 -0300 |
commit | eabf425c76e0089eb88e102e2a44d8c8a37bc213 (patch) | |
tree | 7ad9e9901cbab5f2852187c16560ec74d21a0921 /ldump.c | |
parent | 3b57e37e4821ddce4756428956b7e9f4969efa4c (diff) | |
download | lua-eabf425c76e0089eb88e102e2a44d8c8a37bc213.tar.gz lua-eabf425c76e0089eb88e102e2a44d8c8a37bc213.tar.bz2 lua-eabf425c76e0089eb88e102e2a44d8c8a37bc213.zip |
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.
Diffstat (limited to 'ldump.c')
-rw-r--r-- | ldump.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -144,7 +144,7 @@ static void dumpCode (DumpState *D, const Proto *f) { | |||
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | static void dumpFunction(DumpState *D, const Proto *f); | 147 | static void dumpFunction (DumpState *D, const Proto *f); |
148 | 148 | ||
149 | static void dumpConstants (DumpState *D, const Proto *f) { | 149 | static void dumpConstants (DumpState *D, const Proto *f) { |
150 | int i; | 150 | int i; |
@@ -218,10 +218,6 @@ static void dumpDebug (DumpState *D, const Proto *f) { | |||
218 | 218 | ||
219 | 219 | ||
220 | static void dumpFunction (DumpState *D, const Proto *f) { | 220 | static void dumpFunction (DumpState *D, const Proto *f) { |
221 | if (D->strip) | ||
222 | dumpString(D, NULL); /* no debug info */ | ||
223 | else | ||
224 | dumpString(D, f->source); | ||
225 | dumpInt(D, f->linedefined); | 221 | dumpInt(D, f->linedefined); |
226 | dumpInt(D, f->lastlinedefined); | 222 | dumpInt(D, f->lastlinedefined); |
227 | dumpByte(D, f->numparams); | 223 | dumpByte(D, f->numparams); |
@@ -231,6 +227,7 @@ static void dumpFunction (DumpState *D, const Proto *f) { | |||
231 | dumpConstants(D, f); | 227 | dumpConstants(D, f); |
232 | dumpUpvalues(D, f); | 228 | dumpUpvalues(D, f); |
233 | dumpProtos(D, f); | 229 | dumpProtos(D, f); |
230 | dumpString(D, D->strip ? NULL : f->source); | ||
234 | dumpDebug(D, f); | 231 | dumpDebug(D, f); |
235 | } | 232 | } |
236 | 233 | ||