mirror of
https://github.com/lua/lua.git
synced 2025-01-14 05:43:00 +08:00
avoid possibility of subtle arith. overflow
This commit is contained in:
parent
8217e0d4fe
commit
8950e0c049
4
ltable.c
4
ltable.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltable.c,v 2.111 2015/06/09 14:21:13 roberto Exp roberto $
|
** $Id: ltable.c,v 2.112 2015/07/01 17:46:55 roberto Exp roberto $
|
||||||
** Lua tables (hash)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -501,7 +501,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
|
|||||||
*/
|
*/
|
||||||
const TValue *luaH_getint (Table *t, lua_Integer key) {
|
const TValue *luaH_getint (Table *t, lua_Integer key) {
|
||||||
/* (1 <= key && key <= t->sizearray) */
|
/* (1 <= key && key <= t->sizearray) */
|
||||||
if (l_castS2U(key - 1) < t->sizearray)
|
if (l_castS2U(key) - 1 < t->sizearray)
|
||||||
return &t->array[key - 1];
|
return &t->array[key - 1];
|
||||||
else {
|
else {
|
||||||
Node *n = hashint(t, key);
|
Node *n = hashint(t, key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user