Mercurial > vim
comparison src/typval.c @ 29525:5063dfe96a59 v9.0.0104
patch 9.0.0104: going beyond allocated memory when evaluating string constant
Commit: https://github.com/vim/vim/commit/1e56bda9048a9625bce6e660938c834c5c15b07d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 29 15:28:27 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 29 Jul 2022 16:30:04 +0200 |
parents | 006d525419fa |
children | 86eb4aba16c3 |
comparison
equal
deleted
inserted
replaced
29524:db3afe53702b | 29525:5063dfe96a59 |
---|---|
2088 ++p; | 2088 ++p; |
2089 // A "\<x>" form occupies at least 4 characters, and produces up | 2089 // A "\<x>" form occupies at least 4 characters, and produces up |
2090 // to 9 characters (6 for the char and 3 for a modifier): | 2090 // to 9 characters (6 for the char and 3 for a modifier): |
2091 // reserve space for 5 extra. | 2091 // reserve space for 5 extra. |
2092 if (*p == '<') | 2092 if (*p == '<') |
2093 { | |
2094 int modifiers = 0; | |
2095 int flags = FSK_KEYCODE | FSK_IN_STRING; | |
2096 | |
2093 extra += 5; | 2097 extra += 5; |
2098 | |
2099 // Skip to the '>' to avoid using '{' inside for string | |
2100 // interpolation. | |
2101 if (p[1] != '*') | |
2102 flags |= FSK_SIMPLIFY; | |
2103 if (find_special_key(&p, &modifiers, flags, NULL) != 0) | |
2104 --p; // leave "p" on the ">" | |
2105 } | |
2094 } | 2106 } |
2095 else if (interpolate && (*p == '{' || *p == '}')) | 2107 else if (interpolate && (*p == '{' || *p == '}')) |
2096 { | 2108 { |
2097 if (*p == '{' && p[1] != '{') // start of expression | 2109 if (*p == '{' && p[1] != '{') // start of expression |
2098 break; | 2110 break; |