Uh oh!
There was an error while loading. Please reload this page.
crypto: fix unhandled error in Hash._transform - #63261
Merged
Merged
Conversation
nodejs-github-bot
commented
May 12, 2026
Collaborator
Review requested:
|
Signed-off-by: haramjeong <04harams77@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #63261 +/- ##
==========================================
- Coverage 90.04% 90.04% -0.01%
==========================================
Files 713 713 Lines 225003 225004 +1 Branches 42536 42539 +3 ==========================================
- Hits 202606 202603 -3 - Misses 14177 14183 +6 + Partials 8220 8218 -2
🚀 New features to boost your workflow:
|
haramj
commented
May 26, 2026
MemberAuthor
Hi @nodejs/crypto team, just a gentle ping on this PR. All CI checks have passed, and it addresses a silent error swallowing bug in the Hash stream interface. I'd appreciate it if someone could take a look when you have a moment. Thanks |
tniessen
approved these changes
May 26, 2026
haramj
commented
Jun 2, 2026
MemberAuthor
Hi, @nodejs/crypto ! |
panva
approved these changes
Jun 14, 2026
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Jun 14, 2026
Collaborator
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jun 14, 2026
Collaborator
Landed in 120c2a4 |
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 freeto 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.
Description
This PR fixes a bug where errors occurring during
Hash.prototype.write()were silently swallowed instead of being surfaced.Problem
In
lib/internal/crypto/hash.js, the_transformimplementation did not check the return value ofthis[kHandle].update(). While the synchronousupdate()method correctly throwsERR_CRYPTO_HASH_UPDATE_FAILEDon failure, the streaming interface continued execution even if the underlying ncrypto binding returnedfalse. This resulted in incorrect hash outputs without any error notification to the user.Solution
Updated
Hash.prototype._transformto check the return value of the internalupdate()call. If it returnsfalse, the error is passed to the stream callback, triggering an'error'event as expected for astream.Transforminstance.Validation
test/parallel/test-crypto-hash-stream-error.js.kHandleto simulate anupdatefailure and verifies that an'error'event withERR_CRYPTO_HASH_UPDATE_FAILEDis emitted.test/parallel/test-crypto-hash.js) still pass.Checklist
make lint-jspassesmake test-parallel(relevant to crypto) passesFixes: #63258