mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
vim-patch:8.2.4975: recursive command line loop may cause a crash (#18614)
Problem: Recursive command line loop may cause a crash.
Solution: Limit recursion of getcmdline().
51f0bfb88a
Cherry-pick e_command_too_recursive from patch 8.2.3957.
This commit is contained in:
@@ -804,6 +804,12 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
|
||||
ccline.cmdlen = s->indent;
|
||||
}
|
||||
|
||||
if (cmdline_level == 50) {
|
||||
// Somehow got into a loop recursively calling getcmdline(), bail out.
|
||||
emsg(_(e_command_too_recursive));
|
||||
goto theend;
|
||||
}
|
||||
|
||||
ExpandInit(&s->xpc);
|
||||
ccline.xpc = &s->xpc;
|
||||
|
||||
@@ -995,12 +1001,13 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
|
||||
State = s->save_State;
|
||||
setmouse();
|
||||
ui_cursor_shape(); // may show different cursor shape
|
||||
sb_text_end_cmdline();
|
||||
|
||||
theend:
|
||||
xfree(s->save_p_icm);
|
||||
xfree(ccline.last_colors.cmdbuff);
|
||||
kv_destroy(ccline.last_colors.colors);
|
||||
|
||||
sb_text_end_cmdline();
|
||||
|
||||
char_u *p = ccline.cmdbuff;
|
||||
|
||||
if (ui_has(kUICmdline)) {
|
||||
|
Reference in New Issue
Block a user