Merge pull request #29967 from zeertzjq/vim-9.1.0648

vim-patch:9.1.{0648,0653}
This commit is contained in:
zeertzjq 2024-08-03 08:45:55 +08:00 committed by GitHub
commit 4f3801c925
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View File

@ -227,7 +227,7 @@ void dialog_changed(buf_T *buf, bool checkall)
// restore to empty when write failed // restore to empty when write failed
if (empty_bufname) { if (empty_bufname) {
XFREE_CLEAR(buf->b_fname); buf->b_fname = NULL;
XFREE_CLEAR(buf->b_ffname); XFREE_CLEAR(buf->b_ffname);
XFREE_CLEAR(buf->b_sfname); XFREE_CLEAR(buf->b_sfname);
unchanged(buf, true, false); unchanged(buf, true, false);

View File

@ -8,6 +8,7 @@ local eq = t.eq
local eval = n.eval local eval = n.eval
local exec = n.exec local exec = n.exec
local feed = n.feed local feed = n.feed
local pcall_err = t.pcall_err
before_each(clear) before_each(clear)
@ -51,3 +52,14 @@ it('no crash when closing window with tag in loclist', function()
eq(0, eval('bufexists(g:qf_bufnr)')) eq(0, eval('bufexists(g:qf_bufnr)'))
assert_alive() assert_alive()
end) end)
it('no crash when writing "Untitled" file fails', function()
t.mkdir('Untitled')
finally(function()
vim.uv.fs_rmdir('Untitled')
end)
feed('ifoobar')
command('set bufhidden=unload')
eq('Vim(enew):E502: "Untitled" is a directory', pcall_err(command, 'confirm enew'))
assert_alive()
end)

Binary file not shown.

View File

@ -196,6 +196,12 @@ func Test_crash1_3()
call term_sendkeys(buf, args) call term_sendkeys(buf, args)
call TermWait(buf, 50) call TermWait(buf, 50)
let file = 'crash/dialog_changed_uaf'
let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\<cr>"
let args = printf(cmn_args, vim, file)
call term_sendkeys(buf, args)
call TermWait(buf, 150)
" clean up " clean up
exe buf .. "bw!" exe buf .. "bw!"
bw! bw!