Once you are sure the recovery is ok delete the swap file. Otherwise, you
will continue to get warning messages that the ".swp" file already exists.
+Note: Recovering swap files is best-effort. Vim attempts to validate fields
+and skip corrupted sections, but the swap file format is intended for files
+you trust. A crafted swap file may trigger parser bugs; such reports are
+treated as robustness issues rather than security vulnerabilities.
ENCRYPTION AND THE SWAP FILE *:recover-crypt*
dp->db_txt_end = page_count * mfp->mf_page_size;
}
+ if (dp->db_txt_start < HEADER_SIZE
+ || dp->db_txt_start > dp->db_txt_end)
+ {
+ ml_append(lnum++, (char_u *)_("??? block header corrupted"),
+ (colnr_T)0, TRUE);
+ ++error;
+ has_error = TRUE;
+ dp->db_txt_start = dp->db_txt_end;
+ }
// Make sure there is a NUL at the end of the block so we
// don't go over the end when copying text.
*((char_u *)dp + dp->db_txt_end - 1) = NUL;
msgstr ""
"Project-Id-Version: Vim\n"
"Report-Msgid-Bugs-To: vim-dev@vim.org\n"
-"POT-Creation-Date: 2026-05-07 19:25+0000\n"
+"POT-Creation-Date: 2026-05-15 16:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "??? from here until ???END lines may be messed up"
msgstr ""
+msgid "??? block header corrupted"
+msgstr ""
+
msgid "??? from here until ???END lines may have been inserted/deleted"
msgstr ""
call assert_fails('recover Xfile1', 'E312:')
call assert_equal('Xfile1', @%)
call assert_equal(['???MANY LINES MISSING'], getline(1, '$'))
+ bw!
+ " use an out-of-bounds db_txt_start in the data block (would cause OOB
+ " read past dp->db_index[] in ml_recover() without the bounds check)
+ let b = copy(save_b)
+ let b[8200:8203] = s:little_endian ? 0zFEFFFFFF : 0zFFFFFFFE
+ if s:system_64bit
+ let b[8208:8215] = 0z00FFFFFF.FFFFFF00
+ else
+ let b[8208:8211] = 0z00FFFF00
+ endif
+ call writefile(b, sn)
+ call assert_fails('recover Xfile1', 'E312:')
+ call assert_equal('Xfile1', @%)
+ call assert_match('??? block header corrupted', getline(1))
bw!
call delete(sn)
endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 486,
/**/
485,
/**/