Skip to content

Commit

Permalink
Fix Buffer overrun error
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Feb 3, 2024
1 parent 24758bf commit 0b6f9a8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/build-raw-near-lake-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ async function writeChangesFile(outPath, changesByAccount) {
offset = buffer.writeUInt8(changes.length, offset);
for (let change of changes) {
offset = buffer.writeInt32LE(change, offset);
}

// TODO: Adjust this as needed
if (offset > PAGE_SIZE - 1000) {
console.log('Writing', outPath, offset);
await new Promise((resolve, reject) => {
outStream.write(buffer.slice(0, offset), e => e ? reject(e) : resolve());
});
offset = 0;
// TODO: Adjust this as needed
if (offset > PAGE_SIZE - 1000) {
console.log('Writing', outPath, offset);
await new Promise((resolve, reject) => {
outStream.write(buffer.slice(0, offset), e => e ? reject(e) : resolve());
});
offset = 0;
}
}
}
}
Expand Down

0 comments on commit 0b6f9a8

Please sign in to comment.