Uh oh!
There was an error while loading. Please reload this page.
crypto: fix Hash and Cipher abort on end - #38425
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ayase-252
commented
Apr 27, 2021
Does it also fix issue in #38035 (comment)? It contains invalid string ( |
Uh oh!
There was an error while loading. Please reload this page.
addaleax
commented
Apr 27, 2021
@Linkgoron I think a better approach overall would be validating this on the C++ side instead, where the abort occurs in the first place. |
fix Hash and Cipher aborting when using end with hex and specific lengths of chunks fixes: nodejs#38015
5e277fd to
b89f9abCompareLinkgoron
commented
Apr 27, 2021
I checked now, and it fixes the issue in the comment - or at least it causes an error to get emitted instead of an abort.
Currently it appears to me that the validation in both cases (Hash and Cipher) is already done on the JS side in the |
This pull request has been marked as stale due to 90 days of inactivity. |
Fix
HashandCipheraborting when usingendwithhexand specific lengths of chunks. The issue was caused because there was missing validation on the written content from theendmethod. Note that this actually affects quite a few things in Crypto. This affects decipher/cipher (both deprecated) but also decipheriv/cipheriv as well as Hash and Hmac.I wasn't sure if this should throw in
_transformor create an error and provide it to the callback, but according to the stream docs providing an error to the callback is what's expected - so I would love to get some input on my fix, and if it makes sense.Fixes: #38015