1
0
forked from aniani/vim

patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt

Problem:    Crash syncing swapfile in new buffer when using sodium crypt.
            (James McCoy)
Solution:   Add checks for sodium encryption. (Christian Brabandt,
            closes #12591, closes #12585)
This commit is contained in:
Christian Brabandt
2023-06-27 18:57:10 +01:00
committed by Bram Moolenaar
parent 0256d76a33
commit 19e6c4fd2d
6 changed files with 72 additions and 14 deletions

View File

@@ -105,7 +105,7 @@ func Test_crypt_sodium_v2_startup()
exe buf .. 'bwipe!'
call assert_true(filereadable('Xfoo'))
let buf = RunVimInTerminal('--cmd "set ch=3 cm=xchacha20v2 key=foo" Xfoo', #{rows: 10})
let buf = RunVimInTerminal('--cmd "set ch=3 cm=xchacha20v2 key=foo" Xfoo', #{wait_for_ruler: 0, rows: 10})
call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50)
call StopVimInTerminal(buf)
@@ -392,4 +392,24 @@ func Test_crypt_set_key_changes_buffer()
call delete('Xtest1.txt')
endfunc
func Test_crypt_set_key_segfault()
CheckFeature sodium
defer delete('Xtest2.txt')
new Xtest2.txt
call setline(1, 'nothing')
set cryptmethod=xchacha20
set key=foobar
w
new Xtest3
put ='other content'
setl modified
sil! preserve
bwipe!
set cryptmethod&
set key=
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab