summaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-04 18:55:35 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-04 18:55:35 +0200
commitfb06d767a8d76eead5391302fc88115d6e3879d8 (patch)
tree49fdbffa0db7d3623e78d89c4e4c36a968b9b097 /src/undo.c
parentc363fe1599655232e8bd6e279fbf70d4c1b7baf6 (diff)
downloadvim-git-fb06d767a8d76eead5391302fc88115d6e3879d8.tar.gz
patch 8.1.1812: reading a truncted undo file hangs Vimv8.1.1812
Problem: Reading a truncted undo file hangs Vim. Solution: Check for reading EOF. (closes #4769)
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/undo.c b/src/undo.c
index 4a4a33cc1..a23c2638f 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1317,6 +1317,12 @@ unserialize_uhp(bufinfo_T *bi, char_u *file_name)
int len = undo_read_byte(bi);
int what;
+ if (len == EOF)
+ {
+ corruption_error("truncated", file_name);
+ u_free_uhp(uhp);
+ return NULL;
+ }
if (len == 0)
break;
what = undo_read_byte(bi);