From 7d92ac87e406dc466d5bec5441c64f0051bda204 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 18 Jun 2017 23:54:51 +1000 Subject: src/lapi.js: Do a length check in lua_pushlstring --- src/lapi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2