From e518226713784e628ae7ee077f1b66cb12b9ffd9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 Nov 2017 15:05:44 +0100 Subject: [PATCH] patch 8.0.1317: accessing freed memory in term_wait() Problem: Accessing freed memory in term_wait(). (Dominique Pelle) Solution: Check that the buffer still exists. --- src/terminal.c | 4 ++++ src/version.c | 2 ++ 2 files changed, 6 insertions(+) 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 @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1317, /**/ 1316, /**/