From 656758c86ad929b07bb6422eb0f44cf9f2347aac Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 24 Apr 2017 12:01:42 +0200 Subject: Use maximum 32bit number instead of Number.MAX_SAFE_INTEGER --- src/lutf8lib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lutf8lib.js') diff --git a/src/lutf8lib.js b/src/lutf8lib.js index f58223a..9d53a8c 100644 --- a/src/lutf8lib.js +++ b/src/lutf8lib.js @@ -5,6 +5,7 @@ const assert = require('assert'); const lua = require('./lua.js'); const lapi = require('./lapi.js'); const lauxlib = require('./lauxlib.js'); +const llimit = require('./llimit.js'); const MAXUNICODE = 0x10FFFF; @@ -170,7 +171,7 @@ const codepoint = function(L) { lauxlib.luaL_argcheck(L, pose <= s.length, 3, lua.to_luastring("out of range", true)); if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= Number.MAX_SAFE_INTEGER) + if (pose - posi >= llimit.MAX_INT) return lauxlib.luaL_error(L, lua.to_luastring("string slice too long", true)); let n = (pose - posi) + 1; lauxlib.luaL_checkstack(L, n, lua.to_luastring("string slice too long", true)); -- cgit v1.2.3-54-g00ecf