]> granicus.if.org Git - vim/commitdiff
patch 8.0.1317: accessing freed memory in term_wait() v8.0.1317
authorBram Moolenaar <Bram@vim.org>
Sun, 19 Nov 2017 14:05:44 +0000 (15:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 19 Nov 2017 14:05:44 +0000 (15:05 +0100)
Problem:    Accessing freed memory in term_wait(). (Dominique Pelle)
Solution:   Check that the buffer still exists.

src/terminal.c
src/version.c

index 6cbe3433ff4804c96f112f9f7b17382dc6181663..f1b4313ad8582e6aaf1d00a868fb45a9553b8f1c 100644 (file)
@@ -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();
index 99007ac5c35c10cb5271c24d288dcc130276775f..7e03c4b5060c61d264f96c3c10bfaa9e9f8ee25f 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1317,
 /**/
     1316,
 /**/