summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-06-17 17:51:54 +1000
committerdaurnimator <quae@daurnimator.com>2017-06-17 17:51:54 +1000
commitb5a8760b29531e64e899abd52cb92ac8e6c21426 (patch)
tree3542ed23e62ad70dbe45a0209c4215e1b01bf3f8 /src
parentdd9e8a96e3ec7a7698c36e3612fbda12d7de2d0f (diff)
downloadfengari-b5a8760b29531e64e899abd52cb92ac8e6c21426.tar.gz
fengari-b5a8760b29531e64e899abd52cb92ac8e6c21426.tar.bz2
fengari-b5a8760b29531e64e899abd52cb92ac8e6c21426.zip
src/lstrlib.js: cast to unsigned when packing unsigned
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js4
1 files changed, 2 insertions, 2 deletions
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 */