Skip to content

Commit 0a87f3e

Browse files
committed
Fix signed integer overflow in statistics
A cast of the value above 2^63-1 to `int64_t` has implementation defined behavior, see n1256, 6.3.1.3.3. `lua_pushinteger()` accepts `int64_t`, so passing `uint64_t` value may lead to pushing negative (or other incorrect) value. Let's use Tarantool specific `luaL_pushuint64()` function instead. This is mostly just to make things in the right way: it is unlikely to see such large values in the statistics in practice. See all the details in [1]. [1]: tarantool/tarantool#8464
1 parent d29a025 commit 0a87f3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

smtp/lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static inline void
5555
lua_add_key_u64(lua_State *L, const char *key, uint64_t value)
5656
{
5757
lua_pushstring(L, key);
58-
lua_pushinteger(L, value);
58+
luaL_pushuint64(L, value);
5959
lua_settable(L, -3);
6060
}
6161
/* }}}

0 commit comments

Comments
 (0)