From 9af9778209cd0cbb284f6ff7e88f707418089975 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 3 Apr 2018 12:51:01 +0200 Subject: [PATCH] patch 8.0.1657: crash when reading a channel Problem: Crash when reading a channel. Solution: Clear the write flag before writing. (idea by Shinya Ohyanagi, closes #2769). --- src/channel.c | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/channel.c b/src/channel.c index 3b71472fd..38e639224 100644 --- a/src/channel.c +++ b/src/channel.c @@ -4150,8 +4150,9 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in) if (ret > 0 && in_part->ch_fd != INVALID_FD && FD_ISSET(in_part->ch_fd, wfds)) { - channel_write_input(channel); + /* Clear the flag first, ch_fd may change in channel_write_input(). */ FD_CLR(in_part->ch_fd, wfds); + channel_write_input(channel); --ret; } } diff --git a/src/version.c b/src/version.c index 1c2d802d0..1178d9b2a 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1657, /**/ 1656, /**/ -- 2.40.0