Inist-CNRS / ghostscript-js

Just a nodeJS wrapper for ghostscript
MIT License
12 stars 6 forks source link

node core dumps if 2nd argument is not a function #12

Open mhirsch opened 3 years ago

mhirsch commented 3 years ago

If the 2nd argument to gs.exec() is, for example, undefined, the node process segfaults. It seems like this should be handled more gracefully.

> gs.exec(['-sDEVICE=tiff24nc','-sOutputFile=test.tif','testPDF.pdf'])
undefined
> 

#
# Fatal error in , line 0
# Check failed: receiver.IsJSFunction().
#
#
#
#FailureMessage Object: 0x7fff54c0eff0
 1: 0x7f91dc74f199  [/lib64/libnode.so.83]
 2: 0x7f91dd41a03d V8_Fatal(char const*, ...) [/lib64/libnode.so.83]
 3: 0x7f91dcf9c278 v8::internal::JSReceiver::GetCreationContext() [/lib64/libnode.so.83]
 4: 0x7f91dcc49e09 v8::Object::CreationContext() [/lib64/libnode.so.83]
 5: 0x7f91dc622243 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/lib64/libnode.so.83]
 6: 0x7f91de8fdaf9 Nan::Callback::Call(int, v8::Local<v8::Value>*) const [/home/mhirsch/test-gs-js/node_modules/ghostscript-js/build/Release/ghostscriptjs.node]
 7: 0x7f91de8fdbfa ghostscript::HandleOKCallback() [/home/mhirsch/test-gs-js/node_modules/ghostscript-js/build/Release/ghostscriptjs.node]
 8: 0x7f91de8fd573 Nan::AsyncExecuteComplete(uv_work_s*, int) [/home/mhirsch/test-gs-js/node_modules/ghostscript-js/build/Release/ghostscriptjs.node]
 9: 0x7f91dcb3a1fb  [/lib64/libnode.so.83]
10: 0x7f91dcb3defe  [/lib64/libnode.so.83]
11: 0x7f91dcb50b3c  [/lib64/libnode.so.83]
12: 0x7f91dcb3e7f4 uv_run [/lib64/libnode.so.83]
13: 0x7f91dc71e586 node::NodeMainInstance::Run() [/lib64/libnode.so.83]
14: 0x7f91dc695859 node::Start(int, char**) [/lib64/libnode.so.83]
15: 0x7f91db9fcb75 __libc_start_main [/lib64/libc.so.6]
16: 0x56526a15512e _start [node]
Illegal instruction (core dumped)
rmeja commented 3 years ago

Hello, I just produced an update (v1.1.8) which fixes this issue. Tell me back if it's ok for you.