vim-patch:8.1.1812: reading a truncted undo file hangs Vim

Problem:    Reading a truncted undo file hangs Vim.
Solution:   Check for reading EOF. (closes vim/vim#4769)
fb06d767a8
This commit is contained in:
Jan Edmund Lazo
2020-10-04 18:33:21 -04:00
parent da5bd45e5a
commit 8bd38863e6
2 changed files with 25 additions and 1 deletions

View File

@@ -878,7 +878,12 @@ static u_header_T *unserialize_uhp(bufinfo_T *bi,
for (;; ) {
int len = undo_read_byte(bi);
if (len == 0 || len == EOF) {
if (len == EOF) {
corruption_error("truncated", file_name);
u_free_uhp(uhp);
return NULL;
}
if (len == 0) {
break;
}
int what = undo_read_byte(bi);