node icon indicating copy to clipboard operation
node copied to clipboard

Unreachable code reached when using {stdio: "overlapped"}

Open madebr opened this issue 1 year ago • 1 comments

Version

18.16.0

Platform

Linux fedora 6.3.5-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 30 15:44:17 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

child_process.execSync("ls", {stdio: "overlapped"})

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

Always

What is the expected behavior? Why is that the expected behavior?

Execute the subprocess, and return some object. According to the documentation, pipe should be used on non-Windows systems.

What do you see instead?

A segfault.

node[107754]: ../../src/spawn_sync.cc:934:int node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>): Assertion `"Unreachable code reached" ": " "invalid child stdio type"' failed.
 1: 0x7ff7073fde1c node::Abort() [/lib64/libnode.so.108]
 2: 0x7ff7073fdeab  [/lib64/libnode.so.108]
 3: 0x7ff7074dbbe9 node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>) [/lib64/libnode.so.108]
 4: 0x7ff7074dbeda node::SyncProcessRunner::ParseStdioOptions(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 5: 0x7ff7074dcc5d node::SyncProcessRunner::ParseOptions(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 6: 0x7ff7074dce53 node::SyncProcessRunner::TryInitializeAndRunLoop(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 7: 0x7ff7074dd008 node::SyncProcessRunner::Run(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 8: 0x7ff7074dd127 node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&) [/lib64/libnode.so.108]
 9: 0x7ff7086c60f6 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/lib64/libnode.so.108]
10: 0x7ff7086c66b1  [/lib64/libnode.so.108]
11: 0x7ff7086c6fad v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/lib64/libnode.so.108]
12: 0x7ff708559539  [/lib64/libnode.so.108]
Aborted (core dumped)

Additional information

No response

madebr avatar Jun 16 '23 22:06 madebr

That's an oversight in #29412. It added the 'overlapped' flag to src/process_wrap.cc but not src/spawn_sync.cc. Pull request welcome.

bnoordhuis avatar Jun 17 '23 06:06 bnoordhuis