hitoshura25/cvefixes huggingface dataset:
CVE-2022-1851 (C, published 2022-05-25T13:15Z)
Description: value: Out-of-bounds Read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/testdir/test_textformat.vim
src/textformat.c
src/version.c
Commit message: patch 8.2.5013: after text formatting cursor may be in an invalid position

Problem:    After text formatting the cursor may be in an invalid position.
Solution:   Correct the cursor position after formatting.


Vulnerable code:

Fixed code:
" This was leaving the cursor after the end of a line.  Complicated way to
" have the problem show up with valgrind.
func Test_correct_cursor_position()
  set encoding=iso8859
  new
  norm a0000
  sil! norm gggg0i0gw0gg

  bwipe!
  set encoding=utf8
endfunc


	// formatting may have made the cursor position invalid
	check_cursor();
/**/
    5013,
CVE-2022-1886 (C, published 2022-05-26T15:15Z)
Description: value: Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-122 \u2014 Heap-based Buffer Overflow
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Repository: https://github.com/vim/vim
Files changed:
src/register.c
src/testdir/test_put.vim
src/version.c
Commit message: patch 8.2.5016: access before start of text with a put command

Problem:    Access before start of text with a put command.
Solution:   Check the length is more than zero.


Vulnerable code:
		curbuf->b_op_end.col = col - 1
				- mb_head_off(y_array[y_size - 1],

Fixed code:
	    {
		curbuf->b_op_end.col = col - 1;
		if (len > 0)
		    curbuf->b_op_end.col -= mb_head_off(y_array[y_size - 1],
	    }
" this was putting a mark before the start of a line
func Test_put_empty_register()
  new
  norm yy
  norm [Pi00ggv)s0
  sil! norm [P
  bwipe!
endfunc

/**/
    5016,
CVE-2022-1897 (C, published 2022-05-27T15:15Z)
Description: value: Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-787 \u2014 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/normal.c
src/testdir/test_substitute.vim
src/undo.c
src/version.c
Commit message: patch 8.2.5023: substitute overwrites allocated buffer

Problem:    Substitute overwrites allocated buffer.
Solution:   Disallow undo when in a substitute command.


Vulnerable code:
    if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
    {
	// This command is not allowed while editing a cmdline: beep.
	clearopbeep(oap);
	text_locked_msg();
	goto normal_end;
    }
    if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked())
    if (text_locked())
    {
	clearopbeep(cap->oap);
	text_locked_msg();
    }
	if (text_locked())
	{
	    clearopbeep(cap->oap);
	    text_locked_msg();
	    break;
	}

	if (!checkclearopq(oap))

Fixed code:
/*
 * If currently editing a cmdline or text is locked: beep and give an error
 * message, return TRUE.
 */
    static int
check_text_locked(oparg_T *oap)
{
    if (text_locked())
    {
	clearopbeep(oap);
	text_locked_msg();
	return TRUE;
    }
    return FALSE;
}

    if ((nv_cmds[idx].cmd_flags & NV_NCW)
				&& (check_text_locked(oap) || curbuf_locked()))
	// this command is not allowed now
    if (check_text_locked(cap->oap))
	if (!check_text_locked(cap->oap) && !checkclearopq(oap))
" This was undoign a change in between computing the length and using it.
func Do_Test_sub_undo_change()
  new
  norm o0000000000000000000000000000000000000000000000000000
  silent! s/\%')/\=Repl()
  bwipe!
endfunc

func Test_sub_undo_change()
  func Repl()
    silent! norm g-
  endfunc
  call Do_Test_sub_undo_change()

  func! Repl()
    silent earlier
  endfunc
  call Do_Test_sub_undo_change()

  delfunc Repl
endfunc

    if (text_locked())
    {
	text_locked_msg();
	return;
    }

/**/
    5023,
CVE-2022-1898 (C, published 2022-05-27T09:15Z)
Description: value: Use After Free in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-416 \u2014 Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Repository: https://github.com/vim/vim
Files changed:
src/normal.c
src/testdir/test_tagjump.vim
src/version.c
Commit message: patch 8.2.5024: using freed memory with "]d"

Problem:    Using freed memory with "]d".
Solution:   Copy the pattern before searching.


Vulnerable code:

Fixed code:
	    // Make a copy, if the line was changed it will be freed.
	    ptr = vim_strnsave(ptr, len);
	    if (ptr == NULL)
		return;

	    vim_free(ptr);

  new somefile
  call setline(1, ['first line', '', '#define something 0'])
  sil norm 0o0
  sil! norm ]d
  bwipe!
/**/
    5024,
CVE-2022-1927 (C, published 2022-05-29T14:15Z)
Description: value: Buffer Over-read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-126 \u2014 Buffer Over-read
The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer.
Repository: https://github.com/vim/vim
Files changed:
src/ex_docmd.c
src/testdir/test_excmd.vim
src/version.c
Commit message: patch 8.2.5037: cursor position may be invalid after "0;" range

Problem:    Cursor position may be invalid after "0;" range.
Solution:   Check the cursor position when it was set by ";" in the range.


Vulnerable code:
	    return FAIL;
			    return FAIL;
			return FAIL;
		    return FAIL;
			return FAIL;
			return FAIL;
    return OK;

Fixed code:
    int		need_check_cursor = FALSE;
    int		ret = FAIL;
	    goto theend;
			    goto theend;
			goto theend;
		    goto theend;
			goto theend;
			goto theend;

		// Check the cursor position before returning.
		need_check_cursor = TRUE;
    ret = OK;

theend:
    if (need_check_cursor)
	check_cursor();
    return ret;
" This was leaving the cursor in line zero
func Test_using_zero_in_range()
  new
  norm o00
  silent!  0;s/\%')
  bwipe!
endfunc

/**/
    5037,
CVE-2022-1942 (C, published 2022-05-31T14:15Z)
Description: value: Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-122 \u2014 Heap-based Buffer Overflow
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Repository: https://github.com/vim/vim
Files changed:
src/buffer.c
src/ex_getln.c
src/proto/ex_getln.pro
src/testdir/test_substitute.vim
src/version.c
src/window.c
Commit message: patch 8.2.5043: can open a cmdline window from a substitute expression

Problem:    Can open a cmdline window from a substitute expression.
Solution:   Disallow opening a command line window when text or buffer is
            locked.


Vulnerable code:
    if (text_locked())
    {
	text_locked_msg();
	return FAIL;
    }
    if (curbuf_locked())
int text_locked(void);
void f_setcmdpos(typval_T *argvars, typval_T *rettv);
    if (text_locked())
	text_locked_msg();
    if (curbuf_locked())
	return;

Fixed code:
    if (text_or_buf_locked())
/*
 * Check for text, window or buffer locked.
 * Give an error message and return TRUE if something is locked.
 */
    int
text_or_buf_locked(void)
{
    if (text_locked())
    {
	text_locked_msg();
	return TRUE;
    }
    return curbuf_locked();
}

    // Can't do this when text or buffer is locked.
    if (text_or_buf_locked())
	return K_IGNORE;

int text_locked(void);
int text_or_buf_locked(void);
void f_setcmdpos(typval_T *argvars, typval_T *rettv);
" This was opening a command line window from the expression
func Test_sub_open_cmdline_win()
  " the error only happens in a very specific setup, run a new Vim instance to
  " get a clean starting point.
  let lines =<< trim [SCRIPT]
    norm o0000000000000000000000000000000000000000000000000000
    func Replace()
      norm q/
    endfunc
    s/\%')/\=Replace()
    redir >Xresult
    messages
    redir END
    qall!
  [SCRIPT]
  call writefile(lines, 'Xscript')
  if RunVim([], [], '-u NONE -S Xscript')
    let messages = readfile('Xresult')
    call assert_match('E565: Not allowed to change text or change window', messages[3])
  endif

  call delete('Xscript')
  call delete('Xresult')
endfunc

/**/
    5043,
    if (text_or_buf_locked())
CVE-2022-1968 (C, published 2022-06-02T14:15Z)
Description: value: Use After Free in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-416 \u2014 Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Repository: https://github.com/vim/vim
Files changed:
src/search.c
src/testdir/test_tagjump.vim
src/version.c
Commit message: patch 8.2.5050: using freed memory when searching for pattern in path

Problem:    Using freed memory when searching for pattern in path.
Solution:   Make a copy of the line.


Vulnerable code:
    line = ml_get(lnum);
			line = ml_get(++lnum);
	    line = ml_get(lnum);

Fixed code:

/*
 * Get line "lnum" and copy it into "buf[LSIZE]".
 * The copy is made because the regexp may make the line invalid when using a
 * mark.
 */
    static char_u *
get_line_and_copy(linenr_T lnum, char_u *buf)
{
    char_u *line = ml_get(lnum);

    vim_strncpy(buf, line, LSIZE - 1);
    return buf;
}

    line = get_line_and_copy(lnum, file_line);
			line = get_line_and_copy(++lnum, file_line);
	    line = get_line_and_copy(lnum, file_line);
" this was using a line from ml_get() freed by the regexp
func Test_isearch_copy_line()
  new
  norm o
  norm 0
  0norm o
  sil! norm bc0
  sil! isearch \%')
  bwipe!
endfunc

/**/
    5050,
CVE-2022-2000 (C, published 2022-06-09T16:15Z)
Description: value: Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-787 \u2014 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/ex_docmd.c
src/testdir/test_cmdline.vim
src/version.c
Commit message: patch 8.2.5063: error for a command may go over the end of IObuff

Problem:    Error for a command may go over the end of IObuff.
Solution:   Truncate the message.


Vulnerable code:
    char_u *s = cmd;
    char_u *d;

Fixed code:
    size_t  len = STRLEN(IObuff);
    char_u  *s = cmd;
    char_u  *d;
    if (len > IOSIZE - 100)
    {
	// Not enough space, truncate and put in "...".
	d = IObuff + IOSIZE - 100;
	d -= mb_head_off(IObuff, d);
	STRCPY(d, "...");
    }
func Test_long_error_message()
  " the error should be truncated, not overrun IObuff
  silent! norm Q00000000000000     000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                                                                                                                        
endfunc

/**/
    5063,
CVE-2022-2042 (C, published 2022-06-10T19:15Z)
Description: value: Use After Free in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-416 \u2014 Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Repository: https://github.com/vim/vim
Files changed:
src/spell.c
src/testdir/test_spell_utf8.vim
src/version.c
Commit message: patch 8.2.5072: using uninitialized value and freed memory in spell command

Problem:    Using uninitialized value and freed memory in spell command.
Solution:   Initialize "attr".  Check for empty line early.


Vulnerable code:
    hlf_T	attr;
	// possible.
	    if (*skipwhite(line) == NUL)

Fixed code:
    hlf_T	attr = 0;
	int empty_line;

	// possible.  Note: this ml_get_buf() may make "line" invalid, check
	// for empty line first.
	empty_line = *skipwhite(line) == NUL;
	    if (empty_line)
func Test_check_empty_line()
  " This was using freed memory
  enew
  spellgood! ﬂ
  norm z=
  norm yy
  sil! norm P]svc
  norm P]s

  " set 'encoding' to clear the wordt list
  set enc=latin1
  set enc=utf-8
  bwipe!
endfunc

/**/
    5072,
CVE-2022-2124 (C, published 2022-06-19T10:15Z)
Description: value: Buffer Over-read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-126 \u2014 Buffer Over-read
The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer.
Repository: https://github.com/vim/vim
Files changed:
src/textobject.c
src/version.c
Commit message: patch 8.2.5120: searching for quotes may go over the end of the line

Problem:    Searching for quotes may go over the end of the line.
Solution:   Check for running into the NUL.


Vulnerable code:

Fixed code:
	{
	    // check for going over the end of the line, which can happen if
	    // the line was changed after the Visual area was selected.
	    if (line[i] == NUL)
		break;
	}
/**/
    5120,
CVE-2022-2125 (C, published 2022-06-19T12:15Z)
Description: value: Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-122 \u2014 Heap-based Buffer Overflow
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Repository: https://github.com/vim/vim
Files changed:
src/indent.c
src/testdir/test_indent.vim
src/version.c
Commit message: patch 8.2.5122: lisp indenting my run over the end of the line

Problem:    Lisp indenting my run over the end of the line.
Solution:   Check for NUL earlier.


Vulnerable code:

Fixed code:
		    if (*that == NUL)
			break;
func Test_lisp_indent_quoted()
  " This was going past the end of the line
  new
  setlocal lisp autoindent
  call setline(1, ['"[', '='])
  normal Gvk=

  bwipe!
endfunc

/**/
    5122,
CVE-2022-2126 (C, published 2022-06-19T13:15Z)
Description: value: Out-of-bounds Read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/spellsuggest.c
src/testdir/test_spell.vim
src/version.c
Commit message: patch 8.2.5123: using invalid index when looking for spell suggestions

Problem:    Using invalid index when looking for spell suggestions.
Solution:   Do not decrement the index when it is zero.


Vulnerable code:
			else if (sp->ts_isdiff == DIFF_INSERT)

Fixed code:
			else if (sp->ts_isdiff == DIFF_INSERT
							    && sp->ts_fidx > 0)
func Test_z_equal_on_single_character()
  " this was decrementing the index below zero
  new
  norm a0\Ê
  norm zW
  norm z=

  bwipe!
endfunc

/**/
    5123,
CVE-2022-2129 (C, published 2022-06-19T19:15Z)
Description: value: Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-787 \u2014 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/ex_docmd.c
src/testdir/test_substitute.vim
src/version.c
Commit message: patch 8.2.5126: substitute may overrun destination buffer

Problem:    Substitute may overrun destination buffer.
Solution:   Disallow switching buffers in a substitute expression.


Vulnerable code:
	// Can't edit another file when "curbuf_lock" is set.  Only ":edit"
	// can bring us here, others are stopped earlier.
	if (*eap->arg != NUL && curbuf_locked())

Fixed code:
	// Can't edit another file when "textlock" or "curbuf_lock" is set.
	// Only ":edit" or ":script" can bring us here, others are stopped
	// earlier.
	if (*eap->arg != NUL && text_or_buf_locked())
" This was editing a script file from the expression
func Test_sub_edit_scriptfile()
  new
  norm o0000000000000000000000000000000000000000000000000000
  func EditScript()
    silent! scr! Xfile
  endfunc
  s/\%')/\=EditScript()

  delfunc EditScript
  bwipe!
endfunc

/**/
    5126,
CVE-2022-2175 (C, published 2022-06-23T13:15Z)
Description: value: Buffer Over-read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/ex_getln.c
src/testdir/test_cmdline.vim
src/version.c
Commit message: patch 8.2.5148: invalid memory access when using expression on command line

Problem:    Invalid memory access when using an expression on the command line.
Solution:   Make sure the position does not go negative.


Vulnerable code:
     * Need to save the current command line, to be able to enter
     * a new one...

Fixed code:
    int		save_new_cmdpos = new_cmdpos;
    new_cmdpos = save_new_cmdpos;

" This was making the insert position negative
func Test_cmdline_expr_register()
  exe "sil! norm! ?\<C-\>e0\<C-R>0\<Esc>?\<C-\>e0\<CR>"
endfunc

/**/
    5148,
CVE-2022-2182 (C, published 2022-06-23T18:15Z)
Description: value: Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-122 \u2014 Heap-based Buffer Overflow
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Repository: https://github.com/vim/vim
Files changed:
src/ex_docmd.c
src/testdir/test_cmdline.vim
src/version.c
Commit message: patch 8.2.5150: read past the end of the first line with ":0;'{"

Problem:    Read past the end of the first line with ":0;'{".
Solution:   When on line zero check the column is valid for line one.


Vulnerable code:
		// accept zero as address, so 0;/PATTERN/ works correctly.

Fixed code:
		// accept zero as address, so 0;/PATTERN/ works correctly
		// (where zero usually means to use the first line).
		else
		    check_cursor_col();
func Test_mark_from_line_zero()
  " this was reading past the end of the first (empty) line
  new
  norm oxxxx
  call assert_fails("0;'(", 'E20:')
  bwipe!
endfunc

/**/
    5150,
CVE-2022-2183 (C, published 2022-06-23T19:15Z)
Description: value: Out-of-bounds Read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/indent.c
src/testdir/test_lispwords.vim
src/version.c
Commit message: patch 8.2.5151: reading beyond the end of the line with lisp indenting

Problem:    Reading beyond the end of the line with lisp indenting.
Solution:   Avoid going over the NUL at the end of the line.


Vulnerable code:
		    that++;
		    amount++;
" Tests for 'lispwords' settings being global-local

Fixed code:
		    if (*that != NUL)
		    {
			that++;
			amount++;
		    }
" Tests for 'lispwords' settings being global-local.
" And  other lisp indent stuff.
func Test_lisp_indent_works()
  " This was reading beyond the end of the line
  new
  exe "norm a\tü(\<CR>="
  set lisp
  norm ==
  bwipe!
endfunc

/**/
    5151,
CVE-2022-2206 (C, published 2022-06-26T19:15Z)
Description: value: Out-of-bounds Read in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/vim/vim
Files changed:
src/term.c
src/version.c
Commit message: patch 8.2.5160: accessing invalid memory after changing terminal size

Problem:    Accessing invalid memory after changing terminal size.
Solution:   Adjust cmdline_row and msg_row to the value of Rows.


Vulnerable code:

Fixed code:

    // make sure these values are not invalid
    if (cmdline_row >= Rows)
	cmdline_row = Rows - 1;
    if (msg_row >= Rows)
	msg_row = Rows - 1;
/**/
    5160,
CVE-2022-2207 (C, published 2022-06-27T12:15Z)
Description: value: Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2.
Severity: MEDIUM (CVSS v3 base score: 7.8)
Weakness: CWE-122 \u2014 Heap-based Buffer Overflow
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Repository: https://github.com/vim/vim
Files changed:
src/edit.c
src/version.c
Commit message: patch 8.2.5162: reading before the start of the line with BS in Replace mode

Problem:    Reading before the start of the line with BS in Replace mode.
Solution:   Check the cursor column is more than zero.


Vulnerable code:
	    while (vcol > want_vcol

Fixed code:
	    while (vcol > want_vcol && curwin->w_cursor.col > 0
/**/
    5162,
CVE-2022-2208 (C, published 2022-06-27T13:15Z)
Description: value: NULL Pointer Dereference in GitHub repository vim/vim prior to 8.2.5163.
Severity: MEDIUM (CVSS v3 base score: 5.5)
Weakness: CWE-476 \u2014 NULL Pointer Dereference
The product dereferences a pointer that it expects to be valid but is NULL.
Repository: https://github.com/vim/vim
Files changed:
src/diff.c
src/testdir/test_diffmode.vim
src/version.c
Commit message: patch 8.2.5163: crash when deleting buffers in diff mode

Problem:    Crash when deleting buffers in diff mode.
Solution:   Recompute diffs later.  Skip window without a valid buffer.


Vulnerable code:
		diff_redraw(TRUE);
	if (wp->w_p_diff)

Fixed code:
	    {
		// don't redraw right away, more might change or buffer state
		// is invalid right now
		need_diff_redraw = TRUE;
		redraw_later(VALID);
	    }
	// when closing windows or wiping buffers skip invalid window
	if (wp->w_p_diff && buf_valid(wp->w_buffer))
" This was trying to update diffs for a buffer being closed
func Test_diff_only()
  silent! lfile
  set diff
  lopen
  norm o
  silent! norm o

  set nodiff
  %bwipe!
endfunc

/**/
    5163,