Skip to content

Commit

Permalink
fix(ui_client): check return value of channel_job_start (#27729)
Browse files Browse the repository at this point in the history
Problem: null pointer member access in ui_client_start_server if
channel_job_start returns NULL.

Solution: check for it, return 0 in that case (which is already used to indicate
failure and is handled by main).

Happened on Linux when trying to run Nvim in an old gdbserver instance after having
rebuilt Nvim since. This gave E903 (the nvim binary was deleted, so " (deleted)" appears
as a suffix in the `v:progpath`, making it invalid), then ASAN complains due to the NPD;
instead it now then prints "Failed to start Nvim server!", as expected.
  • Loading branch information
seandewar committed Mar 4, 2024
1 parent a8131ae commit 633bf61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/nvim/ui_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ uint64_t ui_client_start_server(int argc, char **argv)
CALLBACK_READER_INIT, on_err, CALLBACK_NONE,
false, true, true, false, kChannelStdinPipe,
NULL, 0, 0, NULL, &exit_status);
if (!channel) {
return 0;
}

// If stdin is not a pty, it is forwarded to the client.
// Replace stdin in the TUI process with the tty fd.
Expand Down

0 comments on commit 633bf61

Please sign in to comment.