mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
vim-patch:9.0.1477: crash when recovering from corrupted swap file (#23273)
Problem: Crash when recovering from corrupted swap file.
Solution: Check for a valid page count. (closes vim/vim#12275)
b67ba03d3e
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -300,7 +300,12 @@ bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, unsigned page_count)
|
||||
|
||||
// could check here if the block is in the free list
|
||||
|
||||
hp = mf_alloc_bhdr(mfp, page_count);
|
||||
if (page_count > 0) {
|
||||
hp = mf_alloc_bhdr(mfp, page_count);
|
||||
}
|
||||
if (hp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hp->bh_bnum = nr;
|
||||
hp->bh_flags = 0;
|
||||
|
Reference in New Issue
Block a user