Skip to content
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

crypto.createDiffieHellman results in an abort #38302

Closed
zyscoder opened this issue Apr 20, 2021 · 1 comment · Fixed by #38311
Closed

crypto.createDiffieHellman results in an abort #38302

zyscoder opened this issue Apr 20, 2021 · 1 comment · Fixed by #38311
Labels
confirmed-bug Issues with confirmed bugs. crypto Issues and PRs related to the crypto subsystem.

Comments

@zyscoder
Copy link

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

crypto = require('crypto');crypto.createDiffieHellman('','base64',()=>{});

Then the node instance occurs an abort.

How often does it reproduce? Is there a required condition?

This abort can always be triggered following the steps above.

What is the expected behavior?

If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

» node
Welcome to Node.js v16.0.0-pre.
Type ".help" for more information.
> crypto = require('crypto');crypto.createDiffieHellman('','base64',()=>{});
/home/zys/Toolchains/node/node[5114]: ../src/crypto/crypto_util.h:620:node::crypto::ArrayBufferOrViewContents<T>::ArrayBufferOrViewContents(v8::Local<v8::Value>) [with T = char]: Assertion `IsAnyByteSource(buf)' failed.
 1: 0x5643d93bbaf4 node::Abort() [/home/zys/Toolchains/node/node]
 2: 0x5643d93bbb88  [/home/zys/Toolchains/node/node]
 3: 0x5643d95072ec node::crypto::ArrayBufferOrViewContents<char>::ArrayBufferOrViewContents(v8::Local<v8::Value>) [/home/zys/Toolchains/node/node]
 4: 0x5643d955da5a node::crypto::DiffieHellman::New(v8::FunctionCallbackInfo<v8::Value> const&) [/home/zys/Toolchains/node/node]
 5: 0x5643d963a167 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/home/zys/Toolchains/node/node]
 6: 0x5643d963abe2  [/home/zys/Toolchains/node/node]
 7: 0x5643d963b4ad  [/home/zys/Toolchains/node/node]
 8: 0x5643d963b79a v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/zys/Toolchains/node/node]
 9: 0x5643d9fd9259  [/home/zys/Toolchains/node/node]
[2]    5114 abort (core dumped)  /home/zys/Toolchains/node/node                                                                                                                                                                                                  

Additional information

@Ayase-252 Ayase-252 added the crypto Issues and PRs related to the crypto subsystem. label Apr 20, 2021
@EladKeyshawn
Copy link

Can confirm on master I'm working on this

@aduh95 aduh95 added the confirmed-bug Issues with confirmed bugs. label Apr 20, 2021
EladKeyshawn pushed a commit to EladKeyshawn/node that referenced this issue Apr 20, 2021
EladKeyshawn pushed a commit to EladKeyshawn/node that referenced this issue Apr 20, 2021
EladKeyshawn pushed a commit to EladKeyshawn/node that referenced this issue Apr 20, 2021
@aduh95 aduh95 closed this as completed in 88bc864 Apr 23, 2021
targos pushed a commit that referenced this issue Apr 29, 2021
PR-URL: #38311
Fixes: #38302
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants