aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-12-08 17:53:01 +0800
committerGitHub <noreply@github.com>2024-12-08 17:53:01 +0800
commitca4f688ad4d6160e0ec0cb858a6559eb8a39b594 (patch)
tree9a9823776dc32bd47a29e351fbb865f7531b8a1c
parentfe1e2eff062605f7e617885011160a678822fd0c (diff)
downloadrneovim-ca4f688ad4d6160e0ec0cb858a6559eb8a39b594.tar.gz
rneovim-ca4f688ad4d6160e0ec0cb858a6559eb8a39b594.tar.bz2
rneovim-ca4f688ad4d6160e0ec0cb858a6559eb8a39b594.zip
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>
-rw-r--r--src/nvim/message.c2
-rw-r--r--test/old/testdir/gen_opt_test.vim4
2 files changed, 5 insertions, 1 deletions
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;
diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim
index 22ffde5269..a2ad1eb8b4 100644
--- 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']],