From eeebda243a875e3f299f52eefa8da4314fee3cb9 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 6 Jan 2018 22:07:24 +1100 Subject: src/lstrlib.js: Pass byte offsets to DataView constructor --- src/lstrlib.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lstrlib.js b/src/lstrlib.js index 362942d..bd26eba 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -549,7 +549,7 @@ const str_pack = function(L) { case KOption.Kfloat: { /* floating-point options */ let buff = lauxlib.luaL_prepbuffsize(b, size); let n = lauxlib.luaL_checknumber(L, arg); /* get argument */ - let dv = new DataView(buff.buffer); + let dv = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); if (size === 4) dv.setFloat32(0, n, h.islittle); else dv.setFloat64(0, n, h.islittle); lauxlib.luaL_addsize(b, size); -- cgit v1.2.3-70-g09d2