diff options
Diffstat (limited to 'src/lj_bcread.c')
-rw-r--r-- | src/lj_bcread.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_bcread.c b/src/lj_bcread.c index ee7d7c18..55709522 100644 --- a/src/lj_bcread.c +++ b/src/lj_bcread.c | |||
@@ -179,7 +179,7 @@ static const void *bcread_varinfo(GCproto *pt) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | /* Read a single constant key/value of a template table. */ | 181 | /* Read a single constant key/value of a template table. */ |
182 | static void bcread_ktabk(LexState *ls, TValue *o) | 182 | static void bcread_ktabk(LexState *ls, TValue *o, GCtab *t) |
183 | { | 183 | { |
184 | MSize tp = bcread_uleb128(ls); | 184 | MSize tp = bcread_uleb128(ls); |
185 | if (tp >= BCDUMP_KTAB_STR) { | 185 | if (tp >= BCDUMP_KTAB_STR) { |
@@ -191,6 +191,8 @@ static void bcread_ktabk(LexState *ls, TValue *o) | |||
191 | } else if (tp == BCDUMP_KTAB_NUM) { | 191 | } else if (tp == BCDUMP_KTAB_NUM) { |
192 | o->u32.lo = bcread_uleb128(ls); | 192 | o->u32.lo = bcread_uleb128(ls); |
193 | o->u32.hi = bcread_uleb128(ls); | 193 | o->u32.hi = bcread_uleb128(ls); |
194 | } else if (t && tp == BCDUMP_KTAB_NIL) { /* Restore nil value marker. */ | ||
195 | settabV(ls->L, o, t); | ||
194 | } else { | 196 | } else { |
195 | lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); | 197 | lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); |
196 | setpriV(o, ~tp); | 198 | setpriV(o, ~tp); |
@@ -207,15 +209,15 @@ static GCtab *bcread_ktab(LexState *ls) | |||
207 | MSize i; | 209 | MSize i; |
208 | TValue *o = tvref(t->array); | 210 | TValue *o = tvref(t->array); |
209 | for (i = 0; i < narray; i++, o++) | 211 | for (i = 0; i < narray; i++, o++) |
210 | bcread_ktabk(ls, o); | 212 | bcread_ktabk(ls, o, NULL); |
211 | } | 213 | } |
212 | if (nhash) { /* Read hash entries. */ | 214 | if (nhash) { /* Read hash entries. */ |
213 | MSize i; | 215 | MSize i; |
214 | for (i = 0; i < nhash; i++) { | 216 | for (i = 0; i < nhash; i++) { |
215 | TValue key; | 217 | TValue key; |
216 | bcread_ktabk(ls, &key); | 218 | bcread_ktabk(ls, &key, NULL); |
217 | lj_assertLS(!tvisnil(&key), "nil key"); | 219 | lj_assertLS(!tvisnil(&key), "nil key"); |
218 | bcread_ktabk(ls, lj_tab_set(ls->L, t, &key)); | 220 | bcread_ktabk(ls, lj_tab_set(ls->L, t, &key), t); |
219 | } | 221 | } |
220 | } | 222 | } |
221 | return t; | 223 | return t; |