aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);