changeset 32613:de4b01b2d7d1 v9.0.1638

patch 9.0.1638: crypt tests hang and cause memory errors Commit: https://github.com/vim/vim/commit/438d0c5e58aa475179ade9a1b99013733c5b8f06 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 17 15:00:27 2023 +0100 patch 9.0.1638: crypt tests hang and cause memory errors Problem: crypt tests hang and cause memory errors Solution: Move variable to start of function.
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Jun 2023 16:15:04 +0200
parents dea4d9e2a68e
children 9601a65e84e3
files src/fileio.c src/version.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -218,6 +218,7 @@ readfile(
     int		using_b_ffname;
     int		using_b_fname;
     static char *msg_is_a_directory = N_("is a directory");
+    int		eof = FALSE;
 #ifdef FEAT_SODIUM
     int		may_need_lseek = FALSE;
 #endif
@@ -1222,7 +1223,6 @@ retry:
 		    size -= conv_restlen;
 		}
 
-		int eof = FALSE;
 		if (read_buffer)
 		{
 		    /*
@@ -1306,8 +1306,8 @@ retry:
 		    {
 			// set size to 8K + Sodium Crypt Metadata
 			size = WRITEBUFSIZE + crypt_get_max_header_len()
-		     + crypto_secretstream_xchacha20poly1305_HEADERBYTES
-		     + crypto_secretstream_xchacha20poly1305_ABYTES;
+			    + crypto_secretstream_xchacha20poly1305_HEADERBYTES
+				+ crypto_secretstream_xchacha20poly1305_ABYTES;
 			may_need_lseek = TRUE;
 		    }
 
@@ -1328,11 +1328,11 @@ retry:
 			}
 		    }
 # endif
-		    eof = size;
-		    size = read_eintr(fd, ptr, size);
+		    long read_size = size;
+		    size = read_eintr(fd, ptr, read_size);
 		    filesize_count += size;
 		    // hit end of file
-		    eof = (size < eof || filesize_count == filesize_disk);
+		    eof = (size < read_size || filesize_count == filesize_disk);
 		}
 
 #ifdef FEAT_CRYPT
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1638,
+/**/
     1637,
 /**/
     1636,