-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Piping streams into SHA3 without end: false crashes #28245
Copy link
Copy link
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.opensslIssues and PRs related to the OpenSSL dependency.Issues and PRs related to the OpenSSL dependency.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.opensslIssues and PRs related to the OpenSSL dependency.Issues and PRs related to the OpenSSL dependency.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
This code causes a segmentation fault in 12.4.0:
This seems to be caused by
pipecallinghash._flushwhenendis not set tofalse. This code also causes a segmentation fault:This seems to be at least partially caused by the implementation of
_flush:node/lib/internal/crypto/hash.js
Lines 54 to 57 in 908292c
It bypasses the
this[kState][kFinalized]safeguard:node/lib/internal/crypto/hash.js
Lines 79 to 91 in 908292c
Note that this bug only happens when using SHA3,
sha256seems to be working just fine, so there might also be some weirdness in OpenSSL.cc @mcollina @nodejs/crypto @nodejs/streams