mirror of
https://github.com/lua/lua.git
synced 2026-10-29 12:05:26 +00:00
Avoid underflows in 'luaF_getlocalname'
A call like 'debug.getlocal(test, -2147483648)' could decrement -2147483648, causing an underflow. (As this happens in a debug function, the fix was not strictly necessary, but it has no cost in the generated code.)
This commit is contained in:
@@ -853,7 +853,7 @@ static int listlocals (lua_State *L) {
|
||||
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1),
|
||||
1, "Lua function expected");
|
||||
p = getproto(obj_at(L, 1));
|
||||
while ((name = luaF_getlocalname(p, ++i, pc)) != NULL)
|
||||
while ((name = luaF_getlocalname(p, cast_uint(++i), pc)) != NULL)
|
||||
lua_pushstring(L, name);
|
||||
return i-1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user