From 10201f1abfe1669ca8a179a58af49b97609a4df0 Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 14 Jan 2026 17:39:15 +0300 Subject: [PATCH] nfqws2: bitset/bitget check negative from-to --- nfq2/lua.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nfq2/lua.c b/nfq2/lua.c index 35aee64..58a2f58 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -174,7 +174,7 @@ static int luacall_bitget(lua_State *L) uint64_t what = (uint64_t)iwhat; lua_Integer from = luaL_checkinteger(L,2); lua_Integer to = luaL_checkinteger(L,3); - if (from>to || from>47 || to>47) + if (from<0 || to<0 || from>to || from>47 || to>47) luaL_error(L, "bit range invalid"); what = (what >> from) & ~((lua_Integer)-1 << (to-from+1)); @@ -194,7 +194,7 @@ static int luacall_bitset(lua_State *L) int64_t iset = (int64_t)luaL_checklint(L,4); if (iset>0xFFFFFFFFFFFF || iset<-(int64_t)0xFFFFFFFFFFFF) luaL_error(L, "out of range"); uint64_t set = (uint64_t)iset; - if (from>to || from>47 || to>47) + if (from<0 || to<0 || from>to || from>47 || to>47) luaL_error(L, "bit range invalid"); uint64_t mask = ~((uint64_t)-1 << (to-from+1));