Patch 9.0.0104
Problem:    Going beyond allocated memory when evaluating string constant.
Solution:   Properly skip over <Key> 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 <M-…>
  endfunc
  
+ func Test_eval_string_in_special_key()
+   " this was using the '{' inside <> as the start of an interpolated string
+   silent! echo 0{1-$"\<S--{> n|nö%

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220729142908.DC93D1C0C34%40moolenaar.net.

Raspunde prin e-mail lui