msgpackr 1.11.10 → 1.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index-no-eval.cjs +1 -1
- package/dist/index-no-eval.cjs.map +1 -1
- package/dist/index-no-eval.min.js +1 -1
- package/dist/index-no-eval.min.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/node.cjs +16 -11
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +1 -1
- package/dist/test.js.map +1 -1
- package/dist/unpack-no-eval.cjs +1 -1
- package/dist/unpack-no-eval.cjs.map +1 -1
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/stream.js +15 -10
- package/unpack.js +1 -1
package/dist/node.cjs
CHANGED
|
@@ -1032,7 +1032,7 @@ currentExtensions[0x42] = data => {
|
|
|
1032
1032
|
if (length <= 40) {
|
|
1033
1033
|
let out = view.getBigUint64(start);
|
|
1034
1034
|
for (let i = start + 8; i < end; i += 8) {
|
|
1035
|
-
out <<= BigInt(
|
|
1035
|
+
out <<= BigInt(64);
|
|
1036
1036
|
out |= view.getBigUint64(i);
|
|
1037
1037
|
}
|
|
1038
1038
|
return out
|
|
@@ -3172,6 +3172,7 @@ class UnpackrStream extends stream.Transform {
|
|
|
3172
3172
|
options.objectMode = true;
|
|
3173
3173
|
super(options);
|
|
3174
3174
|
options.structures = [];
|
|
3175
|
+
this.maxIncompleteBufferSize = options.maxIncompleteBufferSize !== undefined ? options.maxIncompleteBufferSize : 0x4000000;
|
|
3175
3176
|
this.unpackr = options.unpackr || new Unpackr(options);
|
|
3176
3177
|
}
|
|
3177
3178
|
_transform(chunk, encoding, callback) {
|
|
@@ -3184,19 +3185,23 @@ class UnpackrStream extends stream.Transform {
|
|
|
3184
3185
|
values = this.unpackr.unpackMultiple(chunk);
|
|
3185
3186
|
} catch(error) {
|
|
3186
3187
|
if (error.incomplete) {
|
|
3187
|
-
|
|
3188
|
+
let incompleteBuffer = chunk.slice(error.lastPosition);
|
|
3189
|
+
if (incompleteBuffer.length > this.maxIncompleteBufferSize) {
|
|
3190
|
+
this.incompleteBuffer = null;
|
|
3191
|
+
return callback(new Error('Maximum incomplete buffer size exceeded'))
|
|
3192
|
+
}
|
|
3193
|
+
this.incompleteBuffer = incompleteBuffer;
|
|
3188
3194
|
values = error.values;
|
|
3189
|
-
}
|
|
3190
|
-
|
|
3191
|
-
throw error
|
|
3192
|
-
} finally {
|
|
3193
|
-
for (let value of values || []) {
|
|
3194
|
-
if (value === null)
|
|
3195
|
-
value = this.getNullValue();
|
|
3196
|
-
this.push(value);
|
|
3195
|
+
} else {
|
|
3196
|
+
return callback(error)
|
|
3197
3197
|
}
|
|
3198
3198
|
}
|
|
3199
|
-
|
|
3199
|
+
for (let value of values || []) {
|
|
3200
|
+
if (value === null)
|
|
3201
|
+
value = this.getNullValue();
|
|
3202
|
+
this.push(value);
|
|
3203
|
+
}
|
|
3204
|
+
callback();
|
|
3200
3205
|
}
|
|
3201
3206
|
getNullValue() {
|
|
3202
3207
|
return Symbol.for(null)
|