summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-27 14:08:24 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-27 14:08:24 +0200
commit65aee0b714e809b9f19862f3decd35055ed4de10 (patch)
tree9aaa368563c0481d5a14e29689cc856370e2fba9 /src/fileio.c
parent4cd5c52d64a66ad1984d33462a40e0c6721ca232 (diff)
patch 8.2.3063: crash when switching 'cryptmethod' to xchaha20 with undo filev8.2.3063
Problem: Crash when switching 'cryptmethod' to xchaha20 with an existing undo file. (Martin Tournoij) Solution: Disable reading undo file when decoding can't be done inplace. (issue #8467)
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 7c8f00de3a..4bd773e0bd 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1298,9 +1298,17 @@ retry:
* At start of file: Check for magic number of encryption.
*/
if (filesize == 0 && size > 0)
+ {
cryptkey = check_for_cryptkey(cryptkey, ptr, &size,
&filesize, newfile, sfname,
&did_ask_for_key);
+# ifdef CRYPT_NOT_INPLACE
+ if (curbuf->b_cryptstate != NULL
+ && !crypt_works_inplace(curbuf->b_cryptstate))
+ // reading undo file requires crypt_decode_inplace()
+ read_undo_file = FALSE;
+# endif
+ }
/*
* Decrypt the read bytes. This is done before checking for
* EOF because the crypt layer may be buffering.