Skip to content

Commit 89c64d5

Browse files
committed
patch 7.4.1664
Problem: Crash in :cgetexpr. Solution: Check for NULL pointer. (Dominique) Add a test.
1 parent ea6553b commit 89c64d5

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/quickfix.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ qf_init_ext(
532532
else if (tv->v_type == VAR_LIST)
533533
{
534534
/* Get the next line from the supplied list */
535-
while (p_li && p_li->li_tv.v_type != VAR_STRING)
535+
while (p_li && (p_li->li_tv.v_type != VAR_STRING
536+
|| p_li->li_tv.vval.v_string == NULL))
536537
p_li = p_li->li_next; /* Skip non-string items */
537538

538539
if (!p_li) /* End of the list */

src/testdir/test_quickfix.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,3 +692,8 @@ func Test_caddbuffer_to_empty()
692692
endtry
693693
quit!
694694
endfunc
695+
696+
func Test_cgetexpr_works()
697+
" this must not crash Vim
698+
cgetexpr [$x]
699+
endfunc

src/version.c

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

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1664,
751753
/**/
752754
1663,
753755
/**/

0 commit comments

Comments
 (0)