From 1c536285180f4424e8e21c4992ba749a44f65b79 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 26 Apr 2007 15:21:56 +0000
Subject: [PATCH] updated for version 7.0-231

---
 src/memline.c | 21 +++++++++++++++++++++
 src/version.c |  2 ++
 2 files changed, 23 insertions(+)

diff --git a/src/memline.c b/src/memline.c
index bb1126de10..cd39e06172 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -1015,18 +1015,39 @@ ml_recover()
 	msg_end();
 	goto theend;
     }
+
     /*
      * If we guessed the wrong page size, we have to recalculate the
      * highest block number in the file.
      */
     if (mfp->mf_page_size != (unsigned)char_to_long(b0p->b0_page_size))
     {
+	unsigned previous_page_size = mfp->mf_page_size;
+
 	mf_new_page_size(mfp, (unsigned)char_to_long(b0p->b0_page_size));
+	if (mfp->mf_page_size < previous_page_size)
+	{
+	    msg_start();
+	    msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST);
+	    MSG_PUTS_ATTR(_(" has been damaged (page size is smaller than minimum value).\n"),
+			attr | MSG_HIST);
+	    msg_end();
+	    goto theend;
+	}
 	if ((size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0)
 	    mfp->mf_blocknr_max = 0;	    /* no file or empty file */
 	else
 	    mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size);
 	mfp->mf_infile_count = mfp->mf_blocknr_max;
+
+	/* need to reallocate the memory used to store the data */
+	p = alloc(mfp->mf_page_size);
+	if (p == NULL)
+	    goto theend;
+	mch_memmove(p, hp->bh_data, previous_page_size);
+	vim_free(hp->bh_data);
+	hp->bh_data = p;
+	b0p = (ZERO_BL *)(hp->bh_data);
     }
 
 /*
diff --git a/src/version.c b/src/version.c
index 672a409e06..d7c6b29344 100644
--- a/src/version.c
+++ b/src/version.c
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    231,
 /**/
     230,
 /**/
-- 
GitLab