neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit ca4f688ad4d6160e0ec0cb858a6559eb8a39b594
parent fe1e2eff062605f7e617885011160a678822fd0c
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun,  8 Dec 2024 17:53:01 +0800

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 <h.east.727@gmail.com>
Diffstat:
Msrc/nvim/message.c | 2++
Mtest/old/testdir/gen_opt_test.vim | 4+++-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 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; diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim @@ -268,7 +268,9 @@ let test_values = { \ 'hit-enter,history:1,wait:1'], \ ['xxx', 'history:500', 'hit-enter,history:-1', \ 'hit-enter,history:10001', 'history:0,wait:10001', - \ 'hit-enter']], + \ 'hit-enter', 'history:10,wait:99999999999999999999', + \ 'history:99999999999999999999,wait:10', 'wait:10', + \ 'history:-10', 'history:10,wait:-10']], \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']],