diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 06:27:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 06:27:51 +0800 |
commit | 95839a23581ad678e6dc34bc2935d78f516639e7 (patch) | |
tree | 5f36f205af7fce2c13122993fe2323e6557f720f /test | |
parent | 50107c37782fdeae7ad498c29d37a48cac87d657 (diff) | |
download | rneovim-95839a23581ad678e6dc34bc2935d78f516639e7.tar.gz rneovim-95839a23581ad678e6dc34bc2935d78f516639e7.tar.bz2 rneovim-95839a23581ad678e6dc34bc2935d78f516639e7.zip |
vim-patch:9.0.1494: crash when recovering from corrupted swap file (#23358)
Problem: Crash when recovering from corrupted swap file.
Solution: Bail out when the line index looks wrong. (closes vim/vim#12276)
https://github.com/vim/vim/commit/bf1b7132021bac0fccefebb4a1c24a5f372bae4f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_recover.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/old/testdir/test_recover.vim b/test/old/testdir/test_recover.vim index 81e2dde1e2..e5ea144d31 100644 --- a/test/old/testdir/test_recover.vim +++ b/test/old/testdir/test_recover.vim @@ -303,6 +303,21 @@ func Test_recover_corrupted_swap_file() \ '???END'], getline(1, '$')) bw! + " set the number of lines in the data block to a large value + let b = copy(save_b) + if system_64bit + let b[8208:8215] = 0z00FFFFFF.FFFFFF00 + else + let b[8208:8211] = 0z00FFFF00 + endif + call writefile(b, sn) + call assert_fails('recover Xfile1', 'E312:') + call assert_equal('Xfile1', @%) + call assert_equal(['??? from here until ???END lines may have been inserted/deleted', + \ '', '???', '??? lines may be missing', + \ '???END'], getline(1, '$')) + bw! + " use an invalid text start for the lines in a data block let b = copy(save_b) if system_64bit |