seroval 1.6.3 → 1.6.4

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.
@@ -1382,6 +1382,7 @@ function deserializeTypedArray(ctx, depth, node) {
1382
1382
  var _node$b;
1383
1383
  const construct = getTypedArrayConstructor(node.c);
1384
1384
  const source = deserialize$1(ctx, depth, node.f);
1385
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1385
1386
  const offset = (_node$b = node.b) !== null && _node$b !== void 0 ? _node$b : 0;
1386
1387
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1387
1388
  return assignIndexedValue$1(ctx, node.i, new construct(source, offset, node.l));
@@ -1389,6 +1390,7 @@ function deserializeTypedArray(ctx, depth, node) {
1389
1390
  function deserializeDataView(ctx, depth, node) {
1390
1391
  var _node$b2;
1391
1392
  const source = deserialize$1(ctx, depth, node.f);
1393
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1392
1394
  const offset = (_node$b2 = node.b) !== null && _node$b2 !== void 0 ? _node$b2 : 0;
1393
1395
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1394
1396
  return assignIndexedValue$1(ctx, node.i, new DataView(source, offset, node.l));
@@ -1449,11 +1451,15 @@ function deserializePromiseFulfill(ctx, depth, node) {
1449
1451
  }
1450
1452
  function deserializeIteratorFactoryInstance(ctx, depth, node) {
1451
1453
  deserialize$1(ctx, depth, node.a[0]);
1452
- return sequenceToIterator(deserialize$1(ctx, depth, node.a[1]));
1454
+ const source = deserialize$1(ctx, depth, node.a[1]);
1455
+ if (!source || typeof source !== "object" || !isSequence(source)) throw new SerovalMalformedNodeError(node.a[1]);
1456
+ return sequenceToIterator(source);
1453
1457
  }
1454
1458
  function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
1455
1459
  deserialize$1(ctx, depth, node.a[0]);
1456
- return streamToAsyncIterable(deserialize$1(ctx, depth, node.a[1]));
1460
+ const source = deserialize$1(ctx, depth, node.a[1]);
1461
+ if (!source || typeof source !== "object" || !isStream(source)) throw new SerovalMalformedNodeError(node.a[1]);
1462
+ return streamToAsyncIterable(source);
1457
1463
  }
1458
1464
  function deserializeStreamConstructor(ctx, depth, node) {
1459
1465
  const result = assignIndexedValue$1(ctx, node.i, createStream());
package/dist/dev/index.js CHANGED
@@ -1381,6 +1381,7 @@ function deserializeTypedArray(ctx, depth, node) {
1381
1381
  var _node$b;
1382
1382
  const construct = getTypedArrayConstructor(node.c);
1383
1383
  const source = deserialize$1(ctx, depth, node.f);
1384
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1384
1385
  const offset = (_node$b = node.b) !== null && _node$b !== void 0 ? _node$b : 0;
1385
1386
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1386
1387
  return assignIndexedValue$1(ctx, node.i, new construct(source, offset, node.l));
@@ -1388,6 +1389,7 @@ function deserializeTypedArray(ctx, depth, node) {
1388
1389
  function deserializeDataView(ctx, depth, node) {
1389
1390
  var _node$b2;
1390
1391
  const source = deserialize$1(ctx, depth, node.f);
1392
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1391
1393
  const offset = (_node$b2 = node.b) !== null && _node$b2 !== void 0 ? _node$b2 : 0;
1392
1394
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1393
1395
  return assignIndexedValue$1(ctx, node.i, new DataView(source, offset, node.l));
@@ -1448,11 +1450,15 @@ function deserializePromiseFulfill(ctx, depth, node) {
1448
1450
  }
1449
1451
  function deserializeIteratorFactoryInstance(ctx, depth, node) {
1450
1452
  deserialize$1(ctx, depth, node.a[0]);
1451
- return sequenceToIterator(deserialize$1(ctx, depth, node.a[1]));
1453
+ const source = deserialize$1(ctx, depth, node.a[1]);
1454
+ if (!source || typeof source !== "object" || !isSequence(source)) throw new SerovalMalformedNodeError(node.a[1]);
1455
+ return sequenceToIterator(source);
1452
1456
  }
1453
1457
  function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
1454
1458
  deserialize$1(ctx, depth, node.a[0]);
1455
- return streamToAsyncIterable(deserialize$1(ctx, depth, node.a[1]));
1459
+ const source = deserialize$1(ctx, depth, node.a[1]);
1460
+ if (!source || typeof source !== "object" || !isStream(source)) throw new SerovalMalformedNodeError(node.a[1]);
1461
+ return streamToAsyncIterable(source);
1456
1462
  }
1457
1463
  function deserializeStreamConstructor(ctx, depth, node) {
1458
1464
  const result = assignIndexedValue$1(ctx, node.i, createStream());
package/dist/index.cjs CHANGED
@@ -1375,6 +1375,7 @@ function deserializeTypedArray(ctx, depth, node) {
1375
1375
  var _node$b;
1376
1376
  const construct = getTypedArrayConstructor(node.c);
1377
1377
  const source = deserialize$1(ctx, depth, node.f);
1378
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1378
1379
  const offset = (_node$b = node.b) !== null && _node$b !== void 0 ? _node$b : 0;
1379
1380
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1380
1381
  return assignIndexedValue$1(ctx, node.i, new construct(source, offset, node.l));
@@ -1382,6 +1383,7 @@ function deserializeTypedArray(ctx, depth, node) {
1382
1383
  function deserializeDataView(ctx, depth, node) {
1383
1384
  var _node$b2;
1384
1385
  const source = deserialize$1(ctx, depth, node.f);
1386
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1385
1387
  const offset = (_node$b2 = node.b) !== null && _node$b2 !== void 0 ? _node$b2 : 0;
1386
1388
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1387
1389
  return assignIndexedValue$1(ctx, node.i, new DataView(source, offset, node.l));
@@ -1442,11 +1444,15 @@ function deserializePromiseFulfill(ctx, depth, node) {
1442
1444
  }
1443
1445
  function deserializeIteratorFactoryInstance(ctx, depth, node) {
1444
1446
  deserialize$1(ctx, depth, node.a[0]);
1445
- return sequenceToIterator(deserialize$1(ctx, depth, node.a[1]));
1447
+ const source = deserialize$1(ctx, depth, node.a[1]);
1448
+ if (!source || typeof source !== "object" || !isSequence(source)) throw new SerovalMalformedNodeError(node.a[1]);
1449
+ return sequenceToIterator(source);
1446
1450
  }
1447
1451
  function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
1448
1452
  deserialize$1(ctx, depth, node.a[0]);
1449
- return streamToAsyncIterable(deserialize$1(ctx, depth, node.a[1]));
1453
+ const source = deserialize$1(ctx, depth, node.a[1]);
1454
+ if (!source || typeof source !== "object" || !isStream(source)) throw new SerovalMalformedNodeError(node.a[1]);
1455
+ return streamToAsyncIterable(source);
1450
1456
  }
1451
1457
  function deserializeStreamConstructor(ctx, depth, node) {
1452
1458
  const result = assignIndexedValue$1(ctx, node.i, createStream());
package/dist/index.js CHANGED
@@ -1374,6 +1374,7 @@ function deserializeTypedArray(ctx, depth, node) {
1374
1374
  var _node$b;
1375
1375
  const construct = getTypedArrayConstructor(node.c);
1376
1376
  const source = deserialize$1(ctx, depth, node.f);
1377
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1377
1378
  const offset = (_node$b = node.b) !== null && _node$b !== void 0 ? _node$b : 0;
1378
1379
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1379
1380
  return assignIndexedValue$1(ctx, node.i, new construct(source, offset, node.l));
@@ -1381,6 +1382,7 @@ function deserializeTypedArray(ctx, depth, node) {
1381
1382
  function deserializeDataView(ctx, depth, node) {
1382
1383
  var _node$b2;
1383
1384
  const source = deserialize$1(ctx, depth, node.f);
1385
+ if (!(source instanceof ArrayBuffer)) throw new SerovalMalformedNodeError(node);
1384
1386
  const offset = (_node$b2 = node.b) !== null && _node$b2 !== void 0 ? _node$b2 : 0;
1385
1387
  if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH) throw new SerovalMalformedNodeError(node);
1386
1388
  return assignIndexedValue$1(ctx, node.i, new DataView(source, offset, node.l));
@@ -1441,11 +1443,15 @@ function deserializePromiseFulfill(ctx, depth, node) {
1441
1443
  }
1442
1444
  function deserializeIteratorFactoryInstance(ctx, depth, node) {
1443
1445
  deserialize$1(ctx, depth, node.a[0]);
1444
- return sequenceToIterator(deserialize$1(ctx, depth, node.a[1]));
1446
+ const source = deserialize$1(ctx, depth, node.a[1]);
1447
+ if (!source || typeof source !== "object" || !isSequence(source)) throw new SerovalMalformedNodeError(node.a[1]);
1448
+ return sequenceToIterator(source);
1445
1449
  }
1446
1450
  function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
1447
1451
  deserialize$1(ctx, depth, node.a[0]);
1448
- return streamToAsyncIterable(deserialize$1(ctx, depth, node.a[1]));
1452
+ const source = deserialize$1(ctx, depth, node.a[1]);
1453
+ if (!source || typeof source !== "object" || !isStream(source)) throw new SerovalMalformedNodeError(node.a[1]);
1454
+ return streamToAsyncIterable(source);
1449
1455
  }
1450
1456
  function deserializeStreamConstructor(ctx, depth, node) {
1451
1457
  const result = assignIndexedValue$1(ctx, node.i, createStream());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "seroval",
3
3
  "type": "module",
4
- "version": "1.6.3",
4
+ "version": "1.6.4",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -19,7 +19,7 @@
19
19
  "@types/node": "^26.2.0",
20
20
  "@vitest/ui": "^4.1.10",
21
21
  "esbuild": "^0.28.2",
22
- "temporal-polyfill": "^1.0.3",
22
+ "temporal-polyfill": "^1.0.4",
23
23
  "ts-prune": "^0.10.3",
24
24
  "tsdown": "^0.22.14",
25
25
  "tslib": "^2.8.1",