]> granicus.if.org Git - vim/commitdiff
patch 8.0.1657: crash when reading a channel v8.0.1657
authorBram Moolenaar <Bram@vim.org>
Tue, 3 Apr 2018 10:51:01 +0000 (12:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 3 Apr 2018 10:51:01 +0000 (12:51 +0200)
Problem:    Crash when reading a channel.
Solution:   Clear the write flag before writing. (idea by Shinya Ohyanagi,
            closes #2769).

src/channel.c
src/version.c

index 3b71472fdce34497df82b7baf9322ad012efad3b..38e639224c9380d2f0f4dbdafb07d4c480bd1848 100644 (file)
@@ -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;
        }
     }
index 1c2d802d0bafed00763357a8c28180624b8412fc..1178d9b2a2bb4bb1be3f1d71566fd0065d9c5041 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1657,
 /**/
     1656,
 /**/