Skip to content

Core dump when invoked as a function #78

@pluma

Description

@pluma

This isn't a massive problem but it would be nice if this were handled more gracefully:

> new MCrypt() // fails as expected
Error: MCrypt module could not open
> MCrypt() // results in core dump
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: 0x8daaa0 node::Abort() [node]
 2: 0x8daaec  [node]
 3: 0xad71aa v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0x7f1ce95bb02d MCrypt::New(Nan::FunctionCallbackInfo<v8::Value> const&) [/home/pluma/projects/test/node_modules/mcrypt/build/Release/mcrypt.node]
 5: 0x7f1ce95b7487  [/home/pluma/projects/test/node_modules/mcrypt/build/Release/mcrypt.node]
 6: 0xb5faef  [node]
 7: 0xb60659 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
 8: 0x27bebec5be1d
Aborted (core dumped)

The problem is probably that in a regular function invocation this is left undefined. I think newer versions of V8 (i.e. ever since classes are supported) allow distinguishing between regular functions and constructors so this could me adjusted to result in a TypeError: Constructor MCrypt requires 'new' instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions