@componentor/fs 3.0.12 → 3.0.14
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 +11 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workers/repair.worker.js +11 -7
- package/dist/workers/repair.worker.js.map +1 -1
- package/dist/workers/server.worker.js +1 -1
- package/dist/workers/server.worker.js.map +1 -1
- package/dist/workers/sync-relay.worker.js +1 -1
- package/dist/workers/sync-relay.worker.js.map +1 -1
- package/package.json +3 -3
|
@@ -777,8 +777,8 @@ var VFSEngine = class {
|
|
|
777
777
|
tData = tAlloc;
|
|
778
778
|
tInode = tAlloc;
|
|
779
779
|
}
|
|
780
|
+
this.commitPending();
|
|
780
781
|
if (flags & 1) {
|
|
781
|
-
this.commitPending();
|
|
782
782
|
this.handle.flush();
|
|
783
783
|
}
|
|
784
784
|
const tFlush = this.debug ? performance.now() : 0;
|
|
@@ -1489,7 +1489,8 @@ async function handleRepair(root) {
|
|
|
1489
1489
|
let inodeTableOffset;
|
|
1490
1490
|
let pathTableOffset;
|
|
1491
1491
|
let dataOffset;
|
|
1492
|
-
let
|
|
1492
|
+
let bitmapOffset;
|
|
1493
|
+
let pathTableSize;
|
|
1493
1494
|
const magic = view.getUint32(SUPERBLOCK.MAGIC, true);
|
|
1494
1495
|
const version = view.getUint32(SUPERBLOCK.VERSION, true);
|
|
1495
1496
|
const superblockValid = magic === VFS_MAGIC && version === VFS_VERSION;
|
|
@@ -1500,8 +1501,9 @@ async function handleRepair(root) {
|
|
|
1500
1501
|
inodeTableOffset = view.getFloat64(SUPERBLOCK.INODE_OFFSET, true);
|
|
1501
1502
|
pathTableOffset = view.getFloat64(SUPERBLOCK.PATH_OFFSET, true);
|
|
1502
1503
|
dataOffset = view.getFloat64(SUPERBLOCK.DATA_OFFSET, true);
|
|
1503
|
-
|
|
1504
|
-
|
|
1504
|
+
bitmapOffset = view.getFloat64(SUPERBLOCK.BITMAP_OFFSET, true);
|
|
1505
|
+
pathTableSize = bitmapOffset - pathTableOffset;
|
|
1506
|
+
if (blockSize === 0 || (blockSize & blockSize - 1) !== 0 || inodeCount === 0 || inodeTableOffset >= fileSize || pathTableOffset >= fileSize || dataOffset >= fileSize || pathTableSize <= 0) {
|
|
1505
1507
|
const layout = calculateLayout(DEFAULT_INODE_COUNT, DEFAULT_BLOCK_SIZE, INITIAL_DATA_BLOCKS);
|
|
1506
1508
|
inodeCount = DEFAULT_INODE_COUNT;
|
|
1507
1509
|
blockSize = DEFAULT_BLOCK_SIZE;
|
|
@@ -1509,7 +1511,8 @@ async function handleRepair(root) {
|
|
|
1509
1511
|
inodeTableOffset = layout.inodeTableOffset;
|
|
1510
1512
|
pathTableOffset = layout.pathTableOffset;
|
|
1511
1513
|
dataOffset = layout.dataOffset;
|
|
1512
|
-
|
|
1514
|
+
bitmapOffset = layout.bitmapOffset;
|
|
1515
|
+
pathTableSize = bitmapOffset - pathTableOffset;
|
|
1513
1516
|
}
|
|
1514
1517
|
} else {
|
|
1515
1518
|
const layout = calculateLayout(DEFAULT_INODE_COUNT, DEFAULT_BLOCK_SIZE, INITIAL_DATA_BLOCKS);
|
|
@@ -1519,7 +1522,8 @@ async function handleRepair(root) {
|
|
|
1519
1522
|
inodeTableOffset = layout.inodeTableOffset;
|
|
1520
1523
|
pathTableOffset = layout.pathTableOffset;
|
|
1521
1524
|
dataOffset = layout.dataOffset;
|
|
1522
|
-
|
|
1525
|
+
bitmapOffset = layout.bitmapOffset;
|
|
1526
|
+
pathTableSize = bitmapOffset - pathTableOffset;
|
|
1523
1527
|
}
|
|
1524
1528
|
const decoder2 = new TextDecoder("utf-8", { fatal: true });
|
|
1525
1529
|
const recovered = [];
|
|
@@ -1536,7 +1540,7 @@ async function handleRepair(root) {
|
|
|
1536
1540
|
const size = inodeView.getFloat64(INODE.SIZE, true);
|
|
1537
1541
|
const firstBlock = inodeView.getUint32(INODE.FIRST_BLOCK, true);
|
|
1538
1542
|
const absPathOffset = pathTableOffset + pathOff;
|
|
1539
|
-
if (pathLength === 0 || pathLength > 4096 || absPathOffset + pathLength > fileSize || pathOff + pathLength >
|
|
1543
|
+
if (pathLength === 0 || pathLength > 4096 || absPathOffset + pathLength > fileSize || pathOff + pathLength > pathTableSize) {
|
|
1540
1544
|
lost++;
|
|
1541
1545
|
continue;
|
|
1542
1546
|
}
|