changeset 13569:97720d9a01d4 v8.0.1657

patch 8.0.1657: crash when reading a channel commit https://github.com/vim/vim/commit/9af9778209cd0cbb284f6ff7e88f707418089975 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 3 12:51:01 2018 +0200 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).
author Christian Brabandt <cb@256bit.org>
date Tue, 03 Apr 2018 13:00:07 +0200
parents 5ec18e517884
children d2b609a32753
files src/channel.c src/version.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -4150,8 +4150,9 @@ channel_select_check(int ret_in, void *r
 	if (ret > 0 && in_part->ch_fd != INVALID_FD
 					    && FD_ISSET(in_part->ch_fd, wfds))
 	{
+	    /* Clear the flag first, ch_fd may change in channel_write_input(). */
+	    FD_CLR(in_part->ch_fd, wfds);
 	    channel_write_input(channel);
-	    FD_CLR(in_part->ch_fd, wfds);
 	    --ret;
 	}
     }
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1657,
+/**/
     1656,
 /**/
     1655,