summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-06-18 23:54:51 +1000
committerdaurnimator <quae@daurnimator.com>2017-06-19 00:09:52 +1000
commit7d92ac87e406dc466d5bec5441c64f0051bda204 (patch)
tree712eb1a05e328a8c020e83dca3b9a4ed325519cd /src
parent4723651910e6e6f5cff6f0dce51c00777cc213ce (diff)
downloadfengari-7d92ac87e406dc466d5bec5441c64f0051bda204.tar.gz
fengari-7d92ac87e406dc466d5bec5441c64f0051bda204.tar.bz2
fengari-7d92ac87e406dc466d5bec5441c64f0051bda204.zip
src/lapi.js: Do a length check in lua_pushlstring
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lapi.js b/src/lapi.js
index a25dd16..2d30074 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -236,7 +236,7 @@ const lua_pushlstring = function(L, s, len) {
if (len === 0) {
ts = lstring.luaS_bless(L, []);
} else {
- assert(defs.is_luastring(s), "lua_pushlstring expects array of byte");
+ assert(defs.is_luastring(s) && s.length >= len, "lua_pushlstring expects array of byte");
ts = lstring.luaS_bless(L, s.slice(0, len));
}
lobject.pushsvalue2s(L, ts);