fix(node): fix five trivial bugs across crypto and inspect#6129
Open
fix(node): fix five trivial bugs across crypto and inspect#6129
Conversation
566c4fe to
1a4d8d5
Compare
- Fix isRpcWildcardType checking RpcPromise twice instead of RpcProperty
- Fix randomInt(n, n) infinite loop: reject min >= max, not just min > max
- Fix randomFillSync default size not accounting for offset
- Fix publicEncrypt/publicDecrypt error message saying 'privateKey'
- Fix kState Symbol description ('kFinalized' -> 'kState')
- Add tests for randomInt and randomFillSync edge cases
1a4d8d5 to
1ec608d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
jasnell
approved these changes
Feb 21, 2026
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
Five one-liner bug fixes in the Node.js compatibility layer, plus tests for the two highest-impact ones.
Fixes
isRpcWildcardTypecopy-paste error (internal_inspect.ts:3038): CheckedRpcPromisetwice, never checkedRpcProperty. Inspecting anRpcPropertycould trigger proxy traps.randomInt(n, n)infinite loop (crypto_random.ts:246): Guard wasmin > maxinstead ofmin >= max. Whenmin === max,range = 0, causingRAND_MAX % 0 = NaNand an infinite loop.randomFillSyncdefault size ignores offset (crypto_random.ts:90): Default size wasmaxLengthinstead ofmaxLength - offset, writing past buffer bounds when offset is provided without size.publicEncrypt/publicDecrypterror says "privateKey" (crypto_cipher.ts:621,663): Copy-paste fromprivateEncrypt/privateDecrypt. Changed to'key'.kStateSymbol wrong description (crypto_util.ts:42): WasSymbol('kFinalized'), nowSymbol('kState').Tests
randomIntTest: verifiesrandomInt(5, 5)throwsERR_OUT_OF_RANGE(without fix: hangs forever)randomFillSyncTest: verifiesrandomFillSync(buf, 4)leaves first 4 bytes untouched (without fix: writes out of bounds)