From b5a8760b29531e64e899abd52cb92ac8e6c21426 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 17 Jun 2017 17:51:54 +1000 Subject: src/lstrlib.js: cast to unsigned when packing unsigned --- src/lstrlib.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lstrlib.js b/src/lstrlib.js index b21690b..4e499c9 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -587,8 +587,8 @@ const str_pack = function(L) { case KOption.Kuint: { /* unsigned integers */ let n = lauxlib.luaL_checkinteger(L, arg); if (size < SZINT) - lauxlib.luaL_argcheck(L, n < (1 << (size * NB)), arg, lua.to_luastring("unsigned overflow", true)); - packint(b, n, h.islittle, size, false); + lauxlib.luaL_argcheck(L, (n>>>0) < (1 << (size * NB)), arg, lua.to_luastring("unsigned overflow", true)); + packint(b, n>>>0, h.islittle, size, false); break; } case KOption.Kfloat: { /* floating-point options */ -- cgit v1.2.3-70-g09d2