@componentor/fs 3.0.14 → 3.0.16

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 CHANGED
@@ -570,6 +570,18 @@ Make sure `opfsSync` is enabled (it's `true` by default). Files are mirrored to
570
570
 
571
571
  ## Changelog
572
572
 
573
+ ### v3.0.16 (2026)
574
+
575
+ **Fixes:**
576
+ - Add 10s timeout to main-thread spin-wait — prevents infinite busy loop if SharedWorker is dead or unresponsive
577
+
578
+ ### v3.0.15 (2026)
579
+
580
+ **Fixes:**
581
+ - Add bounds validation to `decodeRequest` — rejects truncated SAB payloads instead of reading out-of-bounds
582
+ - Wrap `decodeRequest` in try/catch in both VFS and OPFS leader loop handlers — corrupt buffers return `status: -1` instead of crashing the leader loop
583
+ - Guard `readPayload` against zero/negative/overflow chunk lengths from stale SAB data
584
+
573
585
  ### v3.0.14 (2026)
574
586
 
575
587
  **Fixes:**
package/dist/index.js CHANGED
@@ -1277,11 +1277,18 @@ var DEFAULT_SAB_SIZE = 2 * 1024 * 1024;
1277
1277
  var instanceRegistry = /* @__PURE__ */ new Map();
1278
1278
  var HEADER_SIZE = SAB_OFFSETS.HEADER_SIZE;
1279
1279
  var _canAtomicsWait = typeof globalThis.WorkerGlobalScope !== "undefined";
1280
+ var SPIN_TIMEOUT_MS = 1e4;
1280
1281
  function spinWait(arr, index, value) {
1281
1282
  if (_canAtomicsWait) {
1282
1283
  Atomics.wait(arr, index, value);
1283
1284
  } else {
1285
+ const start = performance.now();
1284
1286
  while (Atomics.load(arr, index) === value) {
1287
+ if (performance.now() - start > SPIN_TIMEOUT_MS) {
1288
+ throw new Error(
1289
+ `VFS sync operation timed out after ${SPIN_TIMEOUT_MS / 1e3}s \u2014 SharedWorker may be unresponsive`
1290
+ );
1291
+ }
1285
1292
  }
1286
1293
  }
1287
1294
  }