diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-03-24 10:31:48 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-03-24 10:57:38 +0100 |
commit | eafdbc018fbeeec088b82172ff59a413558e92e7 (patch) | |
tree | 2b17b8fbe1fda5d554fcc2f650948c5d64b937e4 | |
parent | 39f700a6c26bada413c194cb1242d7dd01e963e5 (diff) | |
download | fengari-eafdbc018fbeeec088b82172ff59a413558e92e7.tar.gz fengari-eafdbc018fbeeec088b82172ff59a413558e92e7.tar.bz2 fengari-eafdbc018fbeeec088b82172ff59a413558e92e7.zip |
jsstring does not stop on '\0'
-rw-r--r-- | src/lobject.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lobject.js b/src/lobject.js index d713183..8d6b6a3 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -127,6 +127,7 @@ class TValue { while (1) { // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629 u0 = value[idx++]; + if (u0 === 0) { str += "\0"; continue; } // Lua string embed '\0' if (!u0) return str; if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; } u1 = value[idx++] & 63; |