aboutsummaryrefslogtreecommitdiff
path: root/src/lstrlib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-24 12:01:42 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-24 12:09:49 +0200
commit656758c86ad929b07bb6422eb0f44cf9f2347aac (patch)
tree9463a52cfa7e49245054577804f1bd6dcaf22ff8 /src/lstrlib.js
parentd15e00af0798783bdce5e27d2ab43de3ecb3fa4e (diff)
downloadfengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.gz
fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.bz2
fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.zip
Use maximum 32bit number instead of Number.MAX_SAFE_INTEGER
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r--src/lstrlib.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index f8158a8..f26400e 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -8,6 +8,7 @@ const lauxlib = require('./lauxlib.js');
const lobject = require('./lobject.js');
const lua = require('./lua.js');
const luaconf = require('./luaconf.js');
+const llimit = require('./llimit.js');
const CT = lua.constant_types;
const char = lua.char;
@@ -682,7 +683,7 @@ const str_byte = function(L) {
if (posi < 1) posi = 1;
if (pose > l) pose = l;
if (posi > pose) return 0; /* empty interval; return no values */
- if (pose - posi >= Number.MAX_SAFE_INTEGER) /* arithmetic overflow? */
+ if (pose - posi >= llimit.MAX_INT) /* arithmetic overflow? */
return lauxlib.luaL_error(L, lua.to_luastring("string slice too long", true));
let n = (pose - posi) + 1;