summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-19 15:05:44 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-19 15:05:44 +0100
commite518226713784e628ae7ee077f1b66cb12b9ffd9 (patch)
treee304eb20a74501add5a6b30e5f53de6505ad2542
parent44c2bffde74a98acdc60505e57c70cd7cc2afa1e (diff)
patch 8.0.1317: accessing freed memory in term_wait()v8.0.1317
Problem: Accessing freed memory in term_wait(). (Dominique Pelle) Solution: Check that the buffer still exists.
-rw-r--r--src/terminal.c4
-rw-r--r--src/version.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 6cbe3433ff..f1b4313ad8 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3227,6 +3227,10 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
{
mch_check_messages();
parse_queued_messages();
+ if (!buf_valid(buf))
+ /* If the terminal is closed when the channel is closed the
+ * buffer disappears. */
+ break;
ui_delay(10L, FALSE);
}
mch_check_messages();
diff --git a/src/version.c b/src/version.c
index 99007ac5c3..7e03c4b506 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1317,
+/**/
1316,
/**/
1315,