patch 9.1.0913: no error check for neg values for 'messagesopt'

Commit: 
https://github.com/vim/vim/commit/65be834c30fb43abb2e41585b41eefcd2ae06c01
Author: h-east <h.east....@gmail.com>
Date:   Sun Dec 8 10:05:26 2024 +0100

    patch 9.1.0913: no error check for neg values for 'messagesopt'
    
    Problem:  no error check for neg values for 'messagesopt'
              (after v9.1.0908)
    Solution: add additional error checks and tests (h-east)
    
    closes: #16187
    
    Signed-off-by: Shougo Matsushita <shougo.ma...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/message.c b/src/message.c
index f0d1806c6..0fb0013d5 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1133,12 +1133,10 @@ messagesopt_changed(void)
     if (!(messages_flags_new & MESSAGES_HISTORY))
         return FAIL;
 
-    // "history" must be <= 10000
-    if (messages_history_new > 10000)
+    if (messages_history_new < 0 || messages_history_new > 10000)
         return FAIL;
 
-    // "wait" must be <= 10000
-    if (messages_wait_new > 10000)
+    if (messages_wait_new < 0 || messages_wait_new > 10000)
         return FAIL;
 
     msg_flags = messages_flags_new;
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index 74f5ae52c..d1c721ef1 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -237,7 +237,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']],
diff --git a/src/version.c b/src/version.c
index 6dc9a47ec..1333d9dea 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    913,
 /**/
     912,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tKDNX-00Guai-6R%40256bit.org.

Raspunde prin e-mail lui