Problem: Vim crashes with a NULL pointer dereference when a status line is
redrawn next to a vertical separator in silent Ex mode, where the
screen cell arrays are not allocated (tdjackey).
Solution: Skip borrowing the vertical separator highlight when the screen is
not allocated (Hirohito Higashi).
closes: #20776
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
win_T *left = NULL;
win_T *right = NULL;
- if (!redrawing())
+ // In silent Ex mode the screen is not allocated, so LineOffset and
+ // ScreenAttrs are NULL; there is nothing to borrow.
+ if (!redrawing() || ScreenLines == NULL)
return;
FOR_ALL_WINDOWS(left)
call delete('Xerr')
call delete('@')
+ let file = 'crash/poc_borrow_stl_vsep_hl'
+ let args = printf(cmn_args, vim, file)
+ call s:RunCommandAndWait(buf, args ..
+ \ ' && echo "crash 11: [OK]" >> X_crash1_result.txt')
+
" clean up
exe buf .. "bw!"
\ 'crash 8: [OK]',
\ 'crash 9: [OK]',
\ 'crash 10: [OK]',
+ \ 'crash 11: [OK]',
\ ]
call assert_equal(expected, getline(1, '$'))
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 784,
/**/
783,
/**/