Mercurial > vim
comparison src/testdir/test_recover.vim @ 32290:9b0c304500cc v9.0.1477
patch 9.0.1477: crash when recovering from corrupted swap file
Commit: https://github.com/vim/vim/commit/b67ba03d3ef2e6c5f207d508e85fc6906f938028
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 22 21:14:26 2023 +0100
patch 9.0.1477: crash when recovering from corrupted swap file
Problem: Crash when recovering from corrupted swap file.
Solution: Check for a valid page count. (closes https://github.com/vim/vim/issues/12275)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 Apr 2023 22:15:04 +0200 |
parents | cc6522f808de |
children | aa90a1f1a523 |
comparison
equal
deleted
inserted
replaced
32289:272eb607ad91 | 32290:9b0c304500cc |
---|---|
245 let b[4098:4099] = 0z0000 | 245 let b[4098:4099] = 0z0000 |
246 call writefile(b, sn) | 246 call writefile(b, sn) |
247 call assert_fails('recover Xfile1', 'E312:') | 247 call assert_fails('recover Xfile1', 'E312:') |
248 call assert_equal('Xfile1', @%) | 248 call assert_equal('Xfile1', @%) |
249 call assert_equal(['???EMPTY BLOCK'], getline(1, '$')) | 249 call assert_equal(['???EMPTY BLOCK'], getline(1, '$')) |
250 bw! | |
251 | |
252 " set the number of pointers in a pointer block to a large value | |
253 let b = copy(save_b) | |
254 let b[4098:4099] = 0zFFFF | |
255 call writefile(b, sn) | |
256 call assert_fails('recover Xfile1', 'E1364:') | |
257 call assert_equal('Xfile1', @%) | |
250 bw! | 258 bw! |
251 | 259 |
252 " set the block number in a pointer entry to a negative number | 260 " set the block number in a pointer entry to a negative number |
253 let b = copy(save_b) | 261 let b = copy(save_b) |
254 if system_64bit | 262 if system_64bit |