Repository navigation
Conversation
|
@Pybsama is attempting to deploy a commit to the nehanth's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four edge cases in
packages/room-node/ckptdisk.js:pad4():(n + 3) & ~3wraps negative once a part size or running file offset reaches2 GiB(DEFAULT_CAP_GB = 4), causingoff = pad4(off)in_put()to become negative and allowing forged/corruptsizespairs such as[2**31 + 4, 2**31 - 4]to sum to0inbodyBytes()and pass_header()on a 4096-byte file before crashing_get()withRangeError. Replaced withMath.ceil(n / 4) * 4and additiveoff += pad.header.posandheader.sizeselements indecodeHeader(): Reject negativeposand negative, non-integer, or string entries insizeswithCkptDiskError(and loop header reads viareadExact()to avoid short reads on headers >64 KiB) so corrupt checkpoint files are treated as missing and removed cleanly.modelFileId()for small local files:localFileReader.readAt(0, 4 MiB)rejects reads past EOF on local GGUF files smaller than 4 MiB (such as synthetic test models), causingmodelFileId()to returnnull. Clamping toMath.min(size, 4 MiB)hashes small local files cleanly while keeping the exact hash for files>= 4 MiB.POOLED_CKPT_GBinCkptDisk.fromEnv(): RequireNumber.isFinite(gb) && gb > 0soPOOLED_CKPT_GB=Infinityfalls back toDEFAULT_CAP_GBinstead of disabling eviction.Verification
packages/room-node/test/ckptdisk_test.mjs(all 4 confirmed failing prior to the fix, including reproducing theRangeError: Invalid typed array length: 2147483652crash).node --check packages/room-node/ckptdisk.js packages/room-node/test/ckptdisk_test.mjs— PASS.node --test packages/room-node/test/ckptdisk_test.mjs—17 pass, 0 fail.npm run test:packages—217 pass, 0 fail, 6 skipped.npm run test:runtime— PASS (protocol: 4, 6/6 checks).