-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v6.x fix] lib: fix zlib async callback after close #16312
[v6.x fix] lib: fix zlib async callback after close #16312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as the change. However we might need to add a unit test, if someone can figure out how.
/cc @nodejs/streams @addaleax (re zlib) @nodejs/lts |
@@ -594,7 +594,7 @@ Zlib.prototype._processChunk = function(chunk, flushFlag, cb) { | |||
this.callback = null; | |||
} | |||
|
|||
if (self._hadError) | |||
if (self._hadError || !self._handle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think self._hadError
implies !self._handle
, so this might just be if (!self._handle)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want it that way, I can change it. However, I prefer it this way because:
- This is a backport, so the impetus is on minimal changes rather than best code for future as the code is already obsolete
- This makes it explicit (and easier to review) that the change can not cause additional breakage by removing some handling that needs to be explicitly checked that all sites which set
_hadError
also clear_handle
. - In case
_hadError
behavior is changed due to some other case, relying on_handle
might not be guaranteed
But, I don't really know the project well enough to know if my arguments are valid or not. So, either way is fine for me, just let me know if it would be better with just if (!self._handle)
.
9219283
to
b0fadbe
Compare
Move the core logic from `LineParser` should fail handling into the recoverable error check for the REPL default eval. Fixes: nodejs#15704 Backport-PR-URL: nodejs#15773 PR-URL: nodejs#6171 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
@nakedible can you please rebase and respond to @addaleax's comment |
`crypto.createCipher()` sets the fixed IV derived from password and it leads to a security risk of nonce reuse when counter mode is used. A warning is emitted when CTR, GCM or CCM is used in `crypto.createCipher()` to notify users to avoid nonce reuse. Backport-PR-URL: nodejs#16583 Fixes: nodejs#13801 PR-URL: nodejs#13821 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
EVP_CIPHER_CTX_FLAG_WRAP_ALLOW flag needs to be set in using wrap mode ciphers. In `crypto.createCipher()`, AES key wrap mode does not use a default IV defined in RFC3394 but a generated IV with `EVP_BytesToKey()` to be consistent API behaviors with other ciphers. The built-in AES wrap mode in OpenSSL is not supported in FIPS mode as http://openssl.6102.n7.nabble.com/AES-Key-Wrap-in-FIPS-Mode-td50238.html so its tests in FIPS mode are skipped. Backport-PR-URL: nodejs#16584 Fixes: nodejs#15009 PR-URL: nodejs#15037 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
This exception can logically never happen because of the key stretching that takes place first. Failure must therefore be a bug in Node.js and not in the executing script. Backport-PR-URL: nodejs#16585 PR-URL: nodejs#15183 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Closing a zlib stream may throw an uncaught exception afterwards if there was a pending callback still to be invoked. This adds a very minimal fix to the issue as all of this code has been rewritten in later versions. Fixes: nodejs#15625
7ce4aea
to
a390a32
Compare
Rebased. Sorry, sort of dropped the ball on this, because I couldn't get tests for v6.x-staging to pass on my machine. Was something to do with a couple network tests not returning ENOTFOUND but some error. |
@addaleax is this ready to land now? |
fa922b9
to
50c3dab
Compare
ping @addaleax |
1 similar comment
ping @addaleax |
88b6795
to
3c4bb3c
Compare
@MylesBorins Yes, this is still ready :) |
Closing a zlib stream may throw an uncaught exception afterwards if there was a pending callback still to be invoked. This adds a very minimal fix to the issue as all of this code has been rewritten in later versions. Fixes: #15625 PR-URL: #16312 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
landed in 5707f83 |
Closing a zlib stream may throw an uncaught exception afterwards if there was a pending callback still to be invoked. This adds a very minimal fix to the issue as all of this code has been rewritten in later versions. Fixes: #15625 PR-URL: #16312 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
This unfortunately broke ws on osx and needed to be backed out of v6.x We currently have To reproduce with this branch run
edit: test failure was a timeout" |
5bdb18e
to
691cd5a
Compare
0a4c79b
to
988cca8
Compare
Closing as we never had resolution |
A minimal change that will fix #15625. There are no test cases for this, as I have not been able to find a way to trigger this without actually running a busy system in production. The fix is also minimal because I have been able to verify in production that this fixes the issue, by using code like
stream._hadError = true; stream.close()
. The fix is for 6.x only, as the code has been heavily rewritten in 8.x and does not contain this bug anymore.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
zlib