From bafedc76663a9a5ead715b2f0add27b88c029785 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 16 Jun 2017 10:43:05 +0200 Subject: Fix bad test on issigned in unpackint --- src/lstrlib.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2