Skip to content

Commit 438d0c5

Browse files
committed
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.
1 parent 54f50cb commit 438d0c5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/fileio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ readfile(
218218
int using_b_ffname;
219219
int using_b_fname;
220220
static char *msg_is_a_directory = N_("is a directory");
221+
int eof = FALSE;
221222
#ifdef FEAT_SODIUM
222223
int may_need_lseek = FALSE;
223224
#endif
@@ -1222,7 +1223,6 @@ readfile(
12221223
size -= conv_restlen;
12231224
}
12241225

1225-
int eof = FALSE;
12261226
if (read_buffer)
12271227
{
12281228
/*
@@ -1306,8 +1306,8 @@ readfile(
13061306
{
13071307
// set size to 8K + Sodium Crypt Metadata
13081308
size = WRITEBUFSIZE + crypt_get_max_header_len()
1309-
+ crypto_secretstream_xchacha20poly1305_HEADERBYTES
1310-
+ crypto_secretstream_xchacha20poly1305_ABYTES;
1309+
+ crypto_secretstream_xchacha20poly1305_HEADERBYTES
1310+
+ crypto_secretstream_xchacha20poly1305_ABYTES;
13111311
may_need_lseek = TRUE;
13121312
}
13131313

@@ -1328,11 +1328,11 @@ readfile(
13281328
}
13291329
}
13301330
# endif
1331-
eof = size;
1332-
size = read_eintr(fd, ptr, size);
1331+
long read_size = size;
1332+
size = read_eintr(fd, ptr, read_size);
13331333
filesize_count += size;
13341334
// hit end of file
1335-
eof = (size < eof || filesize_count == filesize_disk);
1335+
eof = (size < read_size || filesize_count == filesize_disk);
13361336
}
13371337

13381338
#ifdef FEAT_CRYPT

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1638,
698700
/**/
699701
1637,
700702
/**/

0 commit comments

Comments
 (0)