Title: crypto: fix unhandled error in Hash._transform by haramj · Pull Request #63261 · nodejs/node · GitHub
Open Graph Title: crypto: fix unhandled error in Hash._transform by haramj · Pull Request #63261 · nodejs/node
X Title: crypto: fix unhandled error in Hash._transform by haramj · Pull Request #63261 · nodejs/node
Description: 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 _transform implementation did not check the return value of this[kHandle].update(). While the synchronous update() method correctly throws ERR_CRYPTO_HASH_UPDATE_FAILED on failure, the streaming interface continued execution even if the underlying ncrypto binding returned false. This resulted in incorrect hash outputs without any error notification to the user. Solution Updated Hash.prototype._transform to check the return value of the internal update() call. If it returns false, the error is passed to the stream callback, triggering an 'error' event as expected for a stream.Transform instance. Validation Added a regression test test/parallel/test-crypto-hash-stream-error.js. The test mocks the internal handle using kHandle to simulate an update failure and verifies that an 'error' event with ERR_CRYPTO_HASH_UPDATE_FAILED is emitted. Verified that the test fails without this change and passes with it. Verified that existing crypto tests (test/parallel/test-crypto-hash.js) still pass. Checklist make lint-js passes make test-parallel (relevant to crypto) passes Commit message follows the Node.js guidelines Fixes: #63258
Open Graph Description: 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 _transform implem...
X Description: 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 _transform implem...
Opengraph URL: https://github.com/nodejs/node/pull/63261
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0cf6e5f1-db67-54fc-c1cc-a79d49f02db0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D72E:79F9B:1CA7E97:293253E:6A4CE54C |
| html-safe-nonce | 7f13d15c902fd9b4588f459cad1d97460c2a519440e0a6fa998860d8849ce0c0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzJFOjc5RjlCOjFDQTdFOTc6MjkzMjUzRTo2QTRDRTU0QyIsInZpc2l0b3JfaWQiOiIzMjYxNjk0MzE3Nzk4Njc5ODg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | baf20d405a0fa5d5b22d580392b97e313e0db78eb385940383fb56f2f90da8fd |
| hovercard-subject-tag | pull_request:3666388153 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodejs/node/pull/63261/files |
| twitter:image | https://avatars.githubusercontent.com/u/91401364?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/91401364?s=400&v=4 |
| og:image:alt | 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 _transform implem... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c5a57f04eeb310f57c73fd6d751d957e2ca27ed2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width