changeset 12881:1c05b29ab125 v8.0.1317

patch 8.0.1317: accessing freed memory in term_wait() commit https://github.com/vim/vim/commit/e518226713784e628ae7ee077f1b66cb12b9ffd9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 19 15:05:44 2017 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Sun, 19 Nov 2017 15:15:05 +0100
parents ad5cbf9fba6b
children 53c7865ec6aa
files src/terminal.c src/version.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3227,6 +3227,10 @@ f_term_wait(typval_T *argvars, typval_T 
 	{
 	    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();
--- 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,