summaryrefslogtreecommitdiff
path: root/src/llex.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/llex.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/llex.js')
-rw-r--r--src/llex.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/llex.js b/src/llex.js
index b038619..0927fec 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -9,6 +9,7 @@ const ldo = require('./ldo.js');
const ljstype = require('./ljstype');
const lobject = require('./lobject');
const lua = require('./lua.js');
+const llimit = require('./llimit.js');
const TValue = lobject.TValue;
const CT = lua.constant_types;
const TS = lua.thread_status;
@@ -151,7 +152,7 @@ class LexState {
const save = function(ls, c) {
let b = ls.buff;
if (b.n + 1 > b.buffer.length) {
- if (b.buffer.length >= Number.MAX_SAFE_INTEGER/2)
+ if (b.buffer.length >= llimit.MAX_INT/2)
lexerror(ls, lua.to_luastring("lexical element too long", true), 0);
}
b.buffer[b.n++] = c < 0 ? 255 + c + 1 : c;
@@ -192,7 +193,7 @@ const inclinenumber = function(ls) {
next(ls); /* skip '\n' or '\r' */
if (currIsNewline(ls) && ls.current !== old)
next(ls); /* skip '\n\r' or '\r\n' */
- if (++ls.linenumber >= Number.MAX_SAFE_INTEGER)
+ if (++ls.linenumber >= llimit.MAX_INT)
lexerror(ls, lua.to_luastring("chunk has too many lines", true), 0);
};