aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 6ea1630..f2518e0 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -733,7 +733,7 @@ const unpackint = function(L, str, islittle, size, issigned) {
res = ((res ^ mask) - mask); /* do sign extension */
}
} else if (size > SZINT) { /* must check unread bytes */
- let mask = issigned || res >= 0 ? 0 : MC;
+ let mask = !issigned || res >= 0 ? 0 : MC;
for (let i = limit; i < size; i++) {
if (str[islittle ? i : size - 1 - i] !== mask)
lauxlib.luaL_error(L, lua.to_luastring("%d-byte integer does not fit into Lua Integer"), size);