diff src/undo.c @ 17630:380adf86bf66 v8.1.1812

patch 8.1.1812: reading a truncted undo file hangs Vim commit https://github.com/vim/vim/commit/fb06d767a8d76eead5391302fc88115d6e3879d8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 4 18:55:35 2019 +0200 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 https://github.com/vim/vim/issues/4769)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Aug 2019 19:00:04 +0200
parents d03a52e02f1a
children 0f7ae8010787
line wrap: on
line diff
--- a/src/undo.c
+++ b/src/undo.c
@@ -1317,6 +1317,12 @@ unserialize_uhp(bufinfo_T *bi, char_u *f
 	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);