Comparing version 12.3.1 to 12.3.2
@@ -5,3 +5,3 @@ "use strict"; | ||
const Builder_1 = require("../boc/Builder"); | ||
function readString(slice) { | ||
function readBuffer(slice) { | ||
// Check consistency | ||
@@ -14,13 +14,16 @@ if (slice.remaining % 8 !== 0) { | ||
} | ||
if (slice.remainingRefs === 1 && slice.remaining > 7) { | ||
throw new Error(`invalid string length: ${slice.remaining}`); | ||
if (slice.remainingRefs === 1 && (1023 - slice.remaining) > 7) { | ||
throw new Error(`invalid string length: ${slice.remaining / 8}`); | ||
} | ||
// Read string | ||
let res = slice.readBuffer(slice.remaining / 8).toString(); | ||
let res = slice.readBuffer(slice.remaining / 8); | ||
// Read tail | ||
if (slice.remainingRefs === 1) { | ||
res += readString(slice.readRef()); | ||
res = Buffer.concat([res, readBuffer(slice.readRef())]); | ||
} | ||
return res; | ||
} | ||
function readString(slice) { | ||
return readBuffer(slice).toString(); | ||
} | ||
exports.readString = readString; | ||
@@ -33,7 +36,7 @@ function bufferToCell(src) { | ||
let t = src.slice(127); | ||
builder.storeBuffer(a); | ||
builder.storeRef(bufferToCell(t)); | ||
builder = builder.storeBuffer(a); | ||
builder = builder.storeRef(bufferToCell(t)); | ||
} | ||
else { | ||
builder.storeBuffer(src); | ||
builder = builder.storeBuffer(src); | ||
} | ||
@@ -40,0 +43,0 @@ } |
{ | ||
"name": "ton", | ||
"version": "12.3.1", | ||
"version": "12.3.2", | ||
"repository": "https://github.com/tonwhales/ton.git", | ||
@@ -5,0 +5,0 @@ "author": "Steve Korshakov <steve@korshakov.com>", |
461289
240
11921