Skip to content

Commit 9d1bed5

Browse files
committed
patch 9.1.1043: [security]: segfault in win_line()
Problem: [security]: segfault in win_line() (fizz-is-on-the-way) Solution: Check that ScreenLines is not NULL Github Advisory: GHSA-j3g9-wg22-v955 Signed-off-by: Christian Brabandt <[email protected]>
1 parent 4cbc54a commit 9d1bed5

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/gui.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4478,13 +4478,15 @@ gui_do_scroll(void)
44784478
/*
44794479
* Don't call updateWindow() when nothing has changed (it will overwrite
44804480
* the status line!).
4481+
*
4482+
* Check for ScreenLines, because in ex-mode, we don't have a valid display.
44814483
*/
4482-
if (old_topline != wp->w_topline
4484+
if (ScreenLines != NULL && (old_topline != wp->w_topline
44834485
|| wp->w_redr_type != 0
44844486
#ifdef FEAT_DIFF
44854487
|| old_topfill != wp->w_topfill
44864488
#endif
4487-
)
4489+
))
44884490
{
44894491
int type = UPD_VALID;
44904492

src/testdir/crash/ex_redraw_crash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vdivvi|gIv|÷�X��\��,X��X��\��#X��\��<��\��,X��X

src/testdir/test_crash.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ func Test_crash1_3()
234234
call term_sendkeys(buf, args)
235235
call TermWait(buf, 50)
236236

237+
let file = 'crash/ex_redraw_crash'
238+
let cmn_args = "%s -u NONE -i NONE -n -m -X -Z -e -s -S %s -c ':qa!'"
239+
let args = printf(cmn_args, vim, file)
240+
call term_sendkeys(buf, args)
241+
call TermWait(buf, 150)
242+
237243
" clean up
238244
exe buf .. "bw!"
239245
bw!

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1043,
707709
/**/
708710
1042,
709711
/**/

0 commit comments

Comments
 (0)