]> granicus.if.org Git - vim/commitdiff
patch 8.2.2374: accessing uninitialized memory in test_undo v8.2.2374
authorBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2021 21:04:02 +0000 (22:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2021 21:04:02 +0000 (22:04 +0100)
Problem:    Accessing uninitialized memory in test_undo.
Solution:   Do not look in typebuf.tb_buf if it is empty. (Dominique PellĂ©,
            closes #7697)

src/edit.c
src/version.c

index a152d84499a77f68a2df9b2b8926c85aa293e02f..35e4bc2c4bfcd943f500498d57286e76eafca6d2 100644 (file)
@@ -1586,7 +1586,7 @@ decodeModifyOtherKeys(int c)
     // Recognize:
     // form 0: {lead}{key};{modifier}u
     // form 1: {lead}27;{modifier};{key}~
-    if ((c == CSI || (c == ESC && *p == '[')) && typebuf.tb_len >= 4)
+    if (typebuf.tb_len >= 4 && (c == CSI || (c == ESC && *p == '[')))
     {
        idx = (*p == '[');
        if (p[idx] == '2' && p[idx + 1] == '7' && p[idx + 2] == ';')
index f1b728048a3e1ab47e74f298ef2f7c560bce2809..98f120b2e2490f8d52b9bbca7e9963386fd156ba 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2374,
 /**/
     2373,
 /**/