To: vim_dev@googlegroups.com Subject: Patch 9.0.0104 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0104 Problem: Going beyond allocated memory when evaluating string constant. Solution: Properly skip over form. Files: src/typval.c, src/testdir/test_eval_stuff.vim *** ../vim-9.0.0103/src/typval.c 2022-05-10 18:11:14.000000000 +0100 --- src/typval.c 2022-07-29 15:25:51.351514707 +0100 *************** *** 2090,2096 **** --- 2090,2108 ---- // to 9 characters (6 for the char and 3 for a modifier): // reserve space for 5 extra. if (*p == '<') + { + int modifiers = 0; + int flags = FSK_KEYCODE | FSK_IN_STRING; + extra += 5; + + // Skip to the '>' to avoid using '{' inside for string + // interpolation. + if (p[1] != '*') + flags |= FSK_SIMPLIFY; + if (find_special_key(&p, &modifiers, flags, NULL) != 0) + --p; // leave "p" on the ">" + } } else if (interpolate && (*p == '{' || *p == '}')) { *** ../vim-9.0.0103/src/testdir/test_eval_stuff.vim 2022-05-02 22:44:31.000000000 +0100 --- src/testdir/test_eval_stuff.vim 2022-07-29 15:23:13.367617961 +0100 *************** *** 617,620 **** --- 617,625 ---- nunmap endfunc + func Test_eval_string_in_special_key() + " this was using the '{' inside <> as the start of an interpolated string + silent! echo 0{1-$"\n|nö% + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0103/src/version.c 2022-07-28 22:39:50.615678478 +0100 --- src/version.c 2022-07-29 15:11:14.171612456 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 104, /**/ -- I thought I was eating a crab salad. It turned out to be a crap salad. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///