mirror of
https://github.com/vim/vim.git
synced 2025-09-02 21:13:50 -04:00
patch 8.2.3777: spell file write error not checked
Problem: Spell file write error not checked. Solution: Check writing the prefix conditions. (Bjorn Linse, closes #9323)
This commit is contained in:
parent
f8e9eb8e17
commit
1daedc8381
@ -303,7 +303,7 @@
|
|||||||
for ((np) = (node); (np) != NULL; (np) = (np)->wn_sibling)
|
for ((np) = (node); (np) != NULL; (np) = (np)->wn_sibling)
|
||||||
|
|
||||||
static int set_spell_finish(spelltab_T *new_st);
|
static int set_spell_finish(spelltab_T *new_st);
|
||||||
static int write_spell_prefcond(FILE *fd, garray_T *gap);
|
static int write_spell_prefcond(FILE *fd, garray_T *gap, size_t *fwv);
|
||||||
static int read_region_section(FILE *fd, slang_T *slang, int len);
|
static int read_region_section(FILE *fd, slang_T *slang, int len);
|
||||||
static int read_charflags_section(FILE *fd);
|
static int read_charflags_section(FILE *fd);
|
||||||
static int read_prefcond_section(FILE *fd, slang_T *lp);
|
static int read_prefcond_section(FILE *fd, slang_T *lp);
|
||||||
@ -4977,10 +4977,10 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
|
|||||||
putc(SN_PREFCOND, fd); // <sectionID>
|
putc(SN_PREFCOND, fd); // <sectionID>
|
||||||
putc(SNF_REQUIRED, fd); // <sectionflags>
|
putc(SNF_REQUIRED, fd); // <sectionflags>
|
||||||
|
|
||||||
l = write_spell_prefcond(NULL, &spin->si_prefcond);
|
l = write_spell_prefcond(NULL, &spin->si_prefcond, &fwv);
|
||||||
put_bytes(fd, (long_u)l, 4); // <sectionlen>
|
put_bytes(fd, (long_u)l, 4); // <sectionlen>
|
||||||
|
|
||||||
write_spell_prefcond(fd, &spin->si_prefcond);
|
write_spell_prefcond(fd, &spin->si_prefcond, &fwv);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SN_REP: <repcount> <rep> ...
|
// SN_REP: <repcount> <rep> ...
|
||||||
@ -6567,16 +6567,15 @@ set_spell_finish(spelltab_T *new_st)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the table with prefix conditions to the .spl file.
|
* Write the table with prefix conditions to the .spl file.
|
||||||
* When "fd" is NULL only count the length of what is written.
|
* When "fd" is NULL only count the length of what is written and return it.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
write_spell_prefcond(FILE *fd, garray_T *gap)
|
write_spell_prefcond(FILE *fd, garray_T *gap, size_t *fwv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int len;
|
int len;
|
||||||
int totlen;
|
int totlen;
|
||||||
size_t x UNUSED = 1; // collect return value of fwrite()
|
|
||||||
|
|
||||||
if (fd != NULL)
|
if (fd != NULL)
|
||||||
put_bytes(fd, (long_u)gap->ga_len, 2); // <prefcondcnt>
|
put_bytes(fd, (long_u)gap->ga_len, 2); // <prefcondcnt>
|
||||||
@ -6593,7 +6592,7 @@ write_spell_prefcond(FILE *fd, garray_T *gap)
|
|||||||
if (fd != NULL)
|
if (fd != NULL)
|
||||||
{
|
{
|
||||||
fputc(len, fd);
|
fputc(len, fd);
|
||||||
x &= fwrite(p, (size_t)len, (size_t)1, fd);
|
*fwv &= fwrite(p, (size_t)len, (size_t)1, fd);
|
||||||
}
|
}
|
||||||
totlen += len;
|
totlen += len;
|
||||||
}
|
}
|
||||||
@ -6604,7 +6603,6 @@ write_spell_prefcond(FILE *fd, garray_T *gap)
|
|||||||
return totlen;
|
return totlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use map string "map" for languages "lp".
|
* Use map string "map" for languages "lp".
|
||||||
*/
|
*/
|
||||||
|
@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3777,
|
||||||
/**/
|
/**/
|
||||||
3776,
|
3776,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user