Skip to content

"crypto.createDecipher().end" results in an abort #38015

@zyscoder

Description

@zyscoder

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

crypto.createDecipher('aes-128-gcm','').end('str','hex',()=>{})

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 v14.15.1.
Type ".help" for more information.
> crypto.createDecipher('aes-128-gcm','').end('str','hex',()=>{})
node[37939]: ../src/string_bytes.cc:433:static v8::Maybe<long unsigned int> node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding): Assertion `str->Length() % 2 == 0 && "invalid hex string length"' failed.
 1: 0xa03530 node::Abort() [node]
 2: 0xa035ae  [node]
 3: 0xadb6ba node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding) [node]
 4: 0xb389ce node::StringBytes::InlineDecoder::Decode(node::Environment*, v8::Local<v8::String>, node::encoding) [node]
 5: 0xb3982e void node::crypto::Decode<node::crypto::CipherBase>(v8::FunctionCallbackInfo<v8::Value> const&, void (*)(node::crypto::CipherBase*, v8::FunctionCallbackInfo<v8::Value> const&, char const*, unsigned long)) [node]
 6: 0xbe369b  [node]
 7: 0xbe4c46  [node]
 8: 0xbe52c6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 9: 0x13ff259  [node]
[1]    37939 abort (core dumped)  node                                                                                                                                                                                                                   

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.streamIssues and PRs related to the stream subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions