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.pbkdf2Sync results in an abort #38341

Closed
zyscoder opened this issue Apr 22, 2021 · 3 comments
Closed

crypto.pbkdf2Sync results in an abort #38341

zyscoder opened this issue Apr 22, 2021 · 3 comments
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.pbkdf2Sync('','',1,0,'%');

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.pbkdf2Sync('','',1,0,'%');
/home/zys/Toolchains/node/node[29153]: ../src/debug_utils-inl.h:67:std::string node::SPrintFImpl(const char*): Assertion `(p[1]) == ('%')' failed.
 1: 0x55702a9c4af4 node::Abort() [/home/zys/Toolchains/node/node]
 2: 0x55702a9c4b88  [/home/zys/Toolchains/node/node]
 3: 0x55702a8f4f70 node::SPrintFImpl[abi:cxx11](char const*) [/home/zys/Toolchains/node/node]
 4: 0x55702a8c0519 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > node::SPrintF<>(char const*) [/home/zys/Toolchains/node/node]
 5: 0x55702a8e1544 v8::Local<v8::Value> node::ERR_CRYPTO_INVALID_DIGEST<>(v8::Isolate*, char const*) [/home/zys/Toolchains/node/node]
 6: 0x55702a8e18da  [/home/zys/Toolchains/node/node]
 7: 0x55702ab95e3f node::crypto::DeriveBitsJob<node::crypto::PBKDF2Traits>::New(v8::FunctionCallbackInfo<v8::Value> const&) [/home/zys/Toolchains/node/node]
 8: 0x55702ac43167 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/home/zys/Toolchains/node/node]
 9: 0x55702ac43be2  [/home/zys/Toolchains/node/node]
10: 0x55702ac444ad  [/home/zys/Toolchains/node/node]
11: 0x55702ac4479a v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/zys/Toolchains/node/node]
12: 0x55702b5e2259  [/home/zys/Toolchains/node/node]
[1]    29153 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 22, 2021
@aduh95 aduh95 added the confirmed-bug Issues with confirmed bugs. label Apr 22, 2021
@EladKeyshawn
Copy link

Can confirm on master though not happening in the latest Node release.

@panva
Copy link
Member

panva commented Apr 22, 2021

Can confirm on master though not happening in the latest Node release.

It is for me:

❯ nvm use 16
Now using node v16.0.0 (npm v7.10.0)

~/repo/node fix-38341*
❯ node      
Welcome to Node.js v16.0.0.
Type ".help" for more information.
> crypto.pbkdf2Sync('1','2',1,1,'%');
node[57751]: ../src/debug_utils-inl.h:67:std::string node::SPrintFImpl(const char *): Assertion `(p[1]) == ('%')' failed.

I'm looking into this.

tniessen added a commit to tniessen/node that referenced this issue Apr 22, 2021
tniessen added a commit to tniessen/node that referenced this issue Apr 22, 2021
@tniessen
Copy link
Member

Fix in #38354

tniessen added a commit to tniessen/node that referenced this issue Apr 22, 2021
@panva panva closed this as completed in 81d7e80 Apr 24, 2021
targos pushed a commit that referenced this issue Apr 29, 2021
Fixes: #38341

PR-URL: #38354
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@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.

6 participants