1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Update liblua to 5.4.8

This commit is contained in:
dmiller
2025-08-07 16:20:19 +00:00
parent 9373947e60
commit 08cf89313d
11 changed files with 52 additions and 28 deletions

View File

@@ -37,6 +37,9 @@
static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
const char **name);
static const char strlocal[] = "local";
static const char strupval[] = "upvalue";
static int currentpc (CallInfo *ci) {
lua_assert(isLua(ci));
@@ -497,7 +500,7 @@ static const char *basicgetobjname (const Proto *p, int *ppc, int reg,
int pc = *ppc;
*name = luaF_getlocalname(p, reg + 1, pc);
if (*name) /* is a local? */
return "local";
return strlocal;
/* else try symbolic execution */
*ppc = pc = findsetreg(p, pc, reg);
if (pc != -1) { /* could find instruction? */
@@ -512,7 +515,7 @@ static const char *basicgetobjname (const Proto *p, int *ppc, int reg,
}
case OP_GETUPVAL: {
*name = upvalname(p, GETARG_B(i));
return "upvalue";
return strupval;
}
case OP_LOADK: return kname(p, GETARG_Bx(i), name);
case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name);
@@ -547,15 +550,21 @@ static void rkname (const Proto *p, int pc, Instruction i, const char **name) {
/*
** Check whether table being indexed by instruction 'i' is the
** environment '_ENV'
** environment '_ENV'. If the table is an upvalue, get its name;
** otherwise, find some "name" for the table and check whether
** that name is the name of a local variable (and not, for instance,
** a string). Then check that, if there is a name, it is '_ENV'.
*/
static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) {
int t = GETARG_B(i); /* table index */
const char *name; /* name of indexed variable */
if (isup) /* is 't' an upvalue? */
name = upvalname(p, t);
else /* 't' is a register */
basicgetobjname(p, &pc, t, &name);
else { /* 't' is a register */
const char *what = basicgetobjname(p, &pc, t, &name);
if (what != strlocal && what != strupval)
name = NULL; /* cannot be the variable _ENV */
}
return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
}
@@ -701,7 +710,7 @@ static const char *getupvalname (CallInfo *ci, const TValue *o,
for (i = 0; i < c->nupvalues; i++) {
if (c->upvals[i]->v.p == o) {
*name = upvalname(c->p, i);
return "upvalue";
return strupval;
}
}
return NULL;