mirror of
https://github.com/lua/lua.git
synced 2026-10-28 19:45: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:
@@ -300,7 +300,7 @@ void luaF_freeproto (lua_State *L, Proto *f) {
|
||||
** Look for n-th local variable at line 'line' in function 'func'.
|
||||
** Returns NULL if not found.
|
||||
*/
|
||||
const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
|
||||
const char *luaF_getlocalname (const Proto *f, unsigned local_number, int pc) {
|
||||
int i;
|
||||
for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {
|
||||
if (pc < f->locvars[i].endpc) { /* is variable active? */
|
||||
|
||||
Reference in New Issue
Block a user