Skip to content

crypto.generateKeyPairSync results in an abort in node v14.15.1 #44559

@zyscoder

Description

@zyscoder

Version

v14.15.1, v14.20.0

Platform

Linux zys-lab204l 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

crypto

What steps will reproduce the bug?

Setup a node instance,

$ node

and run the following javascript code.

crypto.generateKeyPairSync('dsa', {modulusLength:1024, divisorLength:0})

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

Always. Require no condition.

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 v14.15.1.
Type ".help" for more information.
> crypto.generateKeyPairSync('dsa', {modulusLength:1024, divisorLength:0})
node[993489]: ../src/node_crypto.cc:6334:void node::crypto::GenerateKeyPairJob::ToResult(v8::Local<v8::Value>*, v8::Local<v8::Value>*, v8::Local<v8::Value>*): Assertion `!errors_.empty()' failed.
 1: 0xa03530 node::Abort() [node]
 2: 0xa035ae  [node]
 3: 0xb3e68e node::crypto::GenerateKeyPairJob::ToResult(v8::Local<v8::Value>*, v8::Local<v8::Value>*, v8::Local<v8::Value>*) [node]
 4: 0xb32aa0 node::crypto::GenerateKeyPair(v8::FunctionCallbackInfo<v8::Value> const&, unsigned int, std::unique_ptr<node::crypto::KeyPairGenerationConfig, std::default_delete<node::crypto::KeyPairGenerationConfig> >) [node]
 5: 0xb33190 node::crypto::GenerateKeyPairDSA(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 6: 0xbe369b  [node]
 7: 0xbe4c46  [node]
 8: 0xbe52c6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 9: 0x13ff259  [node]
[1]    993489 abort (core dumped)  node

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions