CVE-2023-1127 (published 2023-03-01T19:15Z)

Divide By Zero in GitHub repository vim/vim prior to 9.0.1367.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-369
cwe_name: Divide By Zero
description: The product divides a value by zero.
extended_description: This weakness typically occurs when an unexpected value is provided to the product, or if an error occurs that is not properly detected. It frequently occurs in calculations involving physical dimensions such as size, length, width, and height.
         

Fix information:
repo_url: https://github.com/vim/vim
commit_details: repo_url: https://github.com/vim/vim
author: Bram Moolenaar
author_date: 2023-03-01 17:55:31+00:00
msg: patch 9.0.1367: divide by zero in zero-width window

Problem:    Divide by zero in zero-width window.
Solution:   Check the width is positive.
repository: repo_url: https://github.com/vim/vim
repo_name: vim/vim
description: The official Vim repository
repo_language: Vim Script
owner: vim
file_changes: filename: move.c
change_type: ModificationType.MODIFY
diff: @@ -1734,7 +1734,7 @@ scrolldown(
 	    col -= width1;
 	    ++row;
 	}
-	if (col > width2)
+	if (col > width2 && width2 > 0)
 	{
 	    row += col / width2;
 	    col = col % width2;

programming_language: C++
filename: test_window_cmd.vim
change_type: ModificationType.MODIFY
diff: @@ -1772,7 +1772,7 @@ func Test_splitkeep_options()
   let &t_WS = save_WS
 endfunc
 
-function Test_splitkeep_cmdwin_cursor_position()
+func Test_splitkeep_cmdwin_cursor_position()
   set splitkeep=screen
   call setline(1, range(&lines))
 
@@ -1797,9 +1797,9 @@ function Test_splitkeep_cmdwin_cursor_position()
 
   %bwipeout!
   set splitkeep&
-endfunction
+endfunc
 
-function Test_splitkeep_misc()
+func Test_splitkeep_misc()
   set splitkeep=screen
   set splitbelow
 
@@ -1832,7 +1832,7 @@ function Test_splitkeep_misc()
   set splitkeep&
 endfunc
 
-function Test_splitkeep_callback()
+func Test_splitkeep_callback()
   CheckScreendump
   let lines =<< trim END
     set splitkeep=screen
@@ -1865,7 +1865,7 @@ function Test_splitkeep_callback()
   call StopVimInTerminal(buf)
 endfunc
 
-function Test_splitkeep_fold()
+func Test_splitkeep_fold()
   CheckScreendump
 
   let lines =<< trim END
@@ -1895,9 +1895,9 @@ function Test_splitkeep_fold()
   call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {})
 
   call StopVimInTerminal(buf)
-endfunction
+endfunc
 
-function Test_splitkeep_status()
+func Test_splitkeep_status()
   CheckScreendump
 
   let lines =<< trim END
@@ -1915,9 +1915,9 @@ function Test_splitkeep_status()
   call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {})
 
   call StopVimInTerminal(buf)
-endfunction
+endfunc
 
-function Test_new_help_window_on_error()
+func Test_new_help_window_on_error()
   help change.txt
   execute "normal! /CTRL-@\<CR>"
   silent! execute "normal! \<C-W>]"
@@ -1927,7 +1927,26 @@ function Test_new_help_window_on_error()
 
   call assert_equal(wincount, winnr('$'))
   call assert_equal(expand("<cword>"), "'mod'")
-endfunction
+endfunc
+
+func Test_smoothscroll_in_zero_width_window()
+  let save_lines = &lines
+  let save_columns = &columns
+
+  winsize 0 24
+  set cpo+=n
+  exe "noremap 0 \<C-W>n\<C-W>L"
+  norm 000000
+  set number smoothscroll
+  exe "norm \<C-Y>"
+
+  only!
+  let &lines = save_lines
+  let &columns = save_columns
+  set cpo-=n
+  unmap 0
+  set nonumber nosmoothscroll
+endfunc
 
 
 " vim: shiftwidth=2 sts=2 expandtab

programming_language: Lua
filename: version.c
change_type: ModificationType.MODIFY
diff: @@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1367,
 /**/
     1366,
 /**/

programming_language: Ruby