patch 9.0.0104: going beyond allocated memory when evaluating string constant
Problem: Going beyond allocated memory when evaluating string constant.
Solution: Properly skip over <Key> form.
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 3c168f2..c63082e 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
Binary files differ
diff --git a/src/typval.c b/src/typval.c
index a266330..8b69adf 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -2090,7 +2090,19 @@
// 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 == '}'))
{
diff --git a/src/version.c b/src/version.c
index 9f6b194..8c55a62 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 104,
+/**/
103,
/**/
102,