]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1043: [security]: segfault in win_line() v9.1.1043
authorChristian Brabandt <cb@256bit.org>
Mon, 20 Jan 2025 21:55:57 +0000 (22:55 +0100)
committerChristian Brabandt <cb@256bit.org>
Mon, 20 Jan 2025 21:55:57 +0000 (22:55 +0100)
Problem:  [security]: segfault in win_line()
          (fizz-is-on-the-way)
Solution: Check that ScreenLines is not NULL

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-j3g9-wg22-v955

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui.c
src/testdir/crash/ex_redraw_crash [new file with mode: 0644]
src/testdir/test_crash.vim
src/version.c

index 8e7b079a5a4ea463ecff3af5c49080b23f70cfc7..86c40de632aa1ee961f98075e268917499b5b32f 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -4478,13 +4478,15 @@ gui_do_scroll(void)
     /*
      * Don't call updateWindow() when nothing has changed (it will overwrite
      * the status line!).
+     *
+     * Check for ScreenLines, because in ex-mode, we don't have a valid display.
      */
-    if (old_topline != wp->w_topline
+    if (ScreenLines != NULL && (old_topline != wp->w_topline
            || wp->w_redr_type != 0
 #ifdef FEAT_DIFF
            || old_topfill != wp->w_topfill
 #endif
-           )
+           ))
     {
        int type = UPD_VALID;
 
diff --git a/src/testdir/crash/ex_redraw_crash b/src/testdir/crash/ex_redraw_crash
new file mode 100644 (file)
index 0000000..eda294c
--- /dev/null
@@ -0,0 +1 @@
+v\1ediv\1evi|gIv|÷³\16\16\16\e\16\16X\80ý\\80ý,\16\16X\80ýX\80ý\\80ý#\r\16X\80ý\\84ý<\80ý\\80ý,X\16\80ùX
index bfd04ff10f9a1bb6e04913e7e2e984b76bd39c1e..c83ddf29ea1ca6e41a85282bdf5d80b86658ecce 100644 (file)
@@ -234,6 +234,12 @@ func Test_crash1_3()
   call term_sendkeys(buf, args)
   call TermWait(buf, 50)
 
+  let file = 'crash/ex_redraw_crash'
+  let cmn_args = "%s -u NONE -i NONE -n -m -X -Z -e -s -S %s -c ':qa!'"
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args)
+  call TermWait(buf, 150)
+
   " clean up
   exe buf .. "bw!"
   bw!
index 286cbec8cd906f89b65804bc8237ccfd35f2ff3d..7a2e5a803003a67a02f4dcaebd98c29d47504c26 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1043,
 /**/
     1042,
 /**/