From 9f0c0fe0de64bc41efea73a2da881ff0a1036a03 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 10 Sep 2024 11:34:42 -0300 Subject: Bug: Wrong limit for local variables in 16-bit systems USHRT_MAX does not fit in an 'int' in 16-bit systems. --- lapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 332e97d1..04e09cff 100644 --- a/lapi.c +++ b/lapi.c @@ -1343,7 +1343,7 @@ void lua_warning (lua_State *L, const char *msg, int tocont) { LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { Udata *u; lua_lock(L); - api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); + api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value"); u = luaS_newudata(L, size, nuvalue); setuvalue(L, s2v(L->top.p), u); api_incr_top(L); -- cgit v1.2.3-55-g6feb