diff src/eval.c @ 20540:193c0446cf28 v8.2.0824

patch 8.2.0824: still not enough memory allocated when converting string Commit: https://github.com/vim/vim/commit/1919371b2b9ddb1a645f40b59adbd89317530882 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 25 23:01:42 2020 +0200 patch 8.2.0824: still not enough memory allocated when converting string Problem: Still not enough memory allocated when converting string with special character. Solution: Reserve space for expanding K_SPECIAL. (closes #6130)
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 May 2020 23:15:03 +0200
parents 489cb75c76b6
children f502455965c0
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -3515,10 +3515,11 @@ get_string_tv(char_u **arg, typval_T *re
 	{
 	    ++p;
 	    // A "\<x>" form occupies at least 4 characters, and produces up
-	    // to 9 characters (6 for the char and 3 for a modifier): reserve
-	    // space for 5 extra.
+	    // to 21 characters (3 * 6 for the char and 3 for a modifier):
+	    // reserve space for 18 extra.
+	    // Each byte in the char could be encoded as K_SPECIAL K_EXTRA x.
 	    if (*p == '<')
-		extra += 5;
+		extra += 18;
 	}
     }