From e8ddbbdf07838a99545181a5f63d460f4ea7e8a4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 25 Oct 2016 15:33:57 +0200 Subject: [PATCH] list_features(): Hack around infinite loop. msg_putchar() is not updating msg_col, this causes an infinite loop. Observed with execute('version') *nested* in another execute(), in particular this line: let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+') when called by :CheckHealth (see runtime/autoload/health/nvim .. s:check_performance()). But invoking some variation of execute('...execute("version")') is not enough to provoke the bug, maybe it needs to be in a user function? --- src/nvim/version.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nvim/version.c b/src/nvim/version.c index 6b9c8bf6b1..54f03cd3dd 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -2570,7 +2570,11 @@ static void list_features(void) } } else { while (msg_col % width) { + int old_msg_col = msg_col; msg_putchar(' '); + if (old_msg_col == msg_col) { + break; // XXX: Avoid infinite loop. + } } } } else {