diff --git a/src/lj_debug.c b/src/lj_debug.c index 54f7db74..24efd2ff 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c @@ -137,21 +137,22 @@ static BCLine debug_frameline(lua_State *L, GCfunc *fn, cTValue *nextframe) /* Get name of a local variable from slot number and PC. */ static const char *debug_varname(const GCproto *pt, BCPos pc, BCReg slot) { - const uint8_t *p = proto_varinfo(pt); + const char *p = (const char *)proto_varinfo(pt); if (p) { BCPos lastpc = 0; for (;;) { - const char *name = (const char *)p; - uint32_t vn = *p++; + const char *name = p; + uint32_t vn = *(const uint8_t *)p; BCPos startpc, endpc; if (vn < VARNAME__MAX) { if (vn == VARNAME_END) break; /* End of varinfo. */ } else { - while (*p++) ; /* Skip over variable name string. */ + do { p++; } while (*(const uint8_t *)p); /* Skip over variable name. */ } - lastpc = startpc = lastpc + lj_buf_ruleb128((const char **)&p); + p++; + lastpc = startpc = lastpc + lj_buf_ruleb128(&p); if (startpc > pc) break; - endpc = startpc + lj_buf_ruleb128((const char **)&p); + endpc = startpc + lj_buf_ruleb128(&p); if (pc < endpc && slot-- == 0) { if (vn < VARNAME__MAX) { #define VARNAMESTR(name, str) str "\0"