diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-06 15:54:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-06 15:54:05 -0300 |
| commit | 4365a45d681b4e71e3c39148489bb8eae538ccf7 (patch) | |
| tree | ea22f0836f252edd7bc7279772158f2b7e549b1e /lcode.c | |
| parent | be8120906304a8658fab998587b969e0e42f5650 (diff) | |
| download | lua-4365a45d681b4e71e3c39148489bb8eae538ccf7.tar.gz lua-4365a45d681b4e71e3c39148489bb8eae538ccf7.tar.bz2 lua-4365a45d681b4e71e3c39148489bb8eae538ccf7.zip | |
Checks for read-only globals
Diffstat (limited to '')
| -rw-r--r-- | lcode.c | 3 |
1 files changed, 2 insertions, 1 deletions
| @@ -1315,8 +1315,8 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { | |||
| 1315 | luaK_exp2anyreg(fs, t); /* put it in a register */ | 1315 | luaK_exp2anyreg(fs, t); /* put it in a register */ |
| 1316 | if (t->k == VUPVAL) { | 1316 | if (t->k == VUPVAL) { |
| 1317 | lu_byte temp = cast_byte(t->u.info); /* upvalue index */ | 1317 | lu_byte temp = cast_byte(t->u.info); /* upvalue index */ |
| 1318 | lua_assert(isKstr(fs, k)); | ||
| 1319 | t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */ | 1318 | t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */ |
| 1319 | lua_assert(isKstr(fs, k)); | ||
| 1320 | t->u.ind.idx = cast(short, k->u.info); /* literal short string */ | 1320 | t->u.ind.idx = cast(short, k->u.info); /* literal short string */ |
| 1321 | t->k = VINDEXUP; | 1321 | t->k = VINDEXUP; |
| 1322 | } | 1322 | } |
| @@ -1336,6 +1336,7 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { | |||
| 1336 | t->k = VINDEXED; | 1336 | t->k = VINDEXED; |
| 1337 | } | 1337 | } |
| 1338 | } | 1338 | } |
| 1339 | t->u.ind.vidx = -1; /* by default, not a declared global */ | ||
| 1339 | } | 1340 | } |
| 1340 | 1341 | ||
| 1341 | 1342 | ||
