From ca4f688ad4d6160e0ec0cb858a6559eb8a39b594 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 17:53:01 +0800 Subject: vim-patch:9.1.0913: no error check for neg values for 'messagesopt' (#31511) Problem: no error check for neg values for 'messagesopt' (after v9.1.0908) Solution: add additional error checks and tests (h-east) closes: vim/vim#16187 https://github.com/vim/vim/commit/65be834c30fb43abb2e41585b41eefcd2ae06c01 Nvim's getdigits() checks for overflow, so the code change isn't needed. Co-authored-by: h-east --- src/nvim/message.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/message.c b/src/nvim/message.c index d8e6fd3001..edb332a786 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1098,11 +1098,13 @@ int messagesopt_changed(void) return FAIL; } + assert(messages_history_new >= 0); // "history" must be <= 10000 if (messages_history_new > 10000) { return FAIL; } + assert(messages_wait_new >= 0); // "wait" must be <= 10000 if (messages_wait_new > 10000) { return FAIL; -- cgit