|
Karsten Hopp |
1b117f |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
1b117f |
Subject: Patch 7.3.109
|
|
Karsten Hopp |
1b117f |
Fcc: outbox
|
|
Karsten Hopp |
1b117f |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
1b117f |
Mime-Version: 1.0
|
|
Karsten Hopp |
1b117f |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
1b117f |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
1b117f |
------------
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
Patch 7.3.109
|
|
Karsten Hopp |
1b117f |
Problem: Processing new Esperanto spell file fails and crashes Vim.
|
|
Karsten Hopp |
1b117f |
(Dominique Pelle)
|
|
Karsten Hopp |
1b117f |
Solution: When running out of memory give an error. Handle '?' in
|
|
Karsten Hopp |
1b117f |
COMPOUNDRULE properly.
|
|
Karsten Hopp |
1b117f |
Files: src/spell.c
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
*** ../vim-7.3.108/src/spell.c 2010-12-17 18:06:00.000000000 +0100
|
|
Karsten Hopp |
1b117f |
--- src/spell.c 2011-02-01 13:43:52.000000000 +0100
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 3634,3640 ****
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
/* Add all flags to "sl_compallflags". */
|
|
Karsten Hopp |
1b117f |
! if (vim_strchr((char_u *)"+*[]/", c) == NULL
|
|
Karsten Hopp |
1b117f |
&& !byte_in_str(slang->sl_compallflags, c))
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
*ap++ = c;
|
|
Karsten Hopp |
1b117f |
--- 3634,3640 ----
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
/* Add all flags to "sl_compallflags". */
|
|
Karsten Hopp |
1b117f |
! if (vim_strchr((char_u *)"?*+[]/", c) == NULL
|
|
Karsten Hopp |
1b117f |
&& !byte_in_str(slang->sl_compallflags, c))
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
*ap++ = c;
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 3664,3670 ****
|
|
Karsten Hopp |
1b117f |
/* Copy flag to "sl_comprules", unless we run into a wildcard. */
|
|
Karsten Hopp |
1b117f |
if (crp != NULL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (c == '+' || c == '*')
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
vim_free(slang->sl_comprules);
|
|
Karsten Hopp |
1b117f |
slang->sl_comprules = NULL;
|
|
Karsten Hopp |
1b117f |
--- 3664,3670 ----
|
|
Karsten Hopp |
1b117f |
/* Copy flag to "sl_comprules", unless we run into a wildcard. */
|
|
Karsten Hopp |
1b117f |
if (crp != NULL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (c == '?' || c == '+' || c == '*')
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
vim_free(slang->sl_comprules);
|
|
Karsten Hopp |
1b117f |
slang->sl_comprules = NULL;
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 3682,3689 ****
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else /* normal char, "[abc]" and '*' are copied as-is */
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (c == '+' || c == '~')
|
|
Karsten Hopp |
1b117f |
! *pp++ = '\\'; /* "a+" becomes "a\+" */
|
|
Karsten Hopp |
1b117f |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
1b117f |
if (enc_utf8)
|
|
Karsten Hopp |
1b117f |
pp += mb_char2bytes(c, pp);
|
|
Karsten Hopp |
1b117f |
--- 3682,3689 ----
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else /* normal char, "[abc]" and '*' are copied as-is */
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (c == '?' || c == '+' || c == '~')
|
|
Karsten Hopp |
1b117f |
! *pp++ = '\\'; /* "a?" becomes "a\?", "a+" becomes "a\+" */
|
|
Karsten Hopp |
1b117f |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
1b117f |
if (enc_utf8)
|
|
Karsten Hopp |
1b117f |
pp += mb_char2bytes(c, pp);
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 4951,4956 ****
|
|
Karsten Hopp |
1b117f |
--- 4951,4958 ----
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
sblock_T *si_blocks; /* memory blocks used */
|
|
Karsten Hopp |
1b117f |
long si_blocks_cnt; /* memory blocks allocated */
|
|
Karsten Hopp |
1b117f |
+ int si_did_emsg; /* TRUE when ran out of memory */
|
|
Karsten Hopp |
1b117f |
+
|
|
Karsten Hopp |
1b117f |
long si_compress_cnt; /* words to add before lowering
|
|
Karsten Hopp |
1b117f |
compression limit */
|
|
Karsten Hopp |
1b117f |
wordnode_T *si_first_free; /* List of nodes that have been freed during
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 5477,5497 ****
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! /* Concatenate this string to previously defined ones, using a
|
|
Karsten Hopp |
1b117f |
! * slash to separate them. */
|
|
Karsten Hopp |
1b117f |
! l = (int)STRLEN(items[1]) + 1;
|
|
Karsten Hopp |
1b117f |
! if (compflags != NULL)
|
|
Karsten Hopp |
1b117f |
! l += (int)STRLEN(compflags) + 1;
|
|
Karsten Hopp |
1b117f |
! p = getroom(spin, l, FALSE);
|
|
Karsten Hopp |
1b117f |
! if (p != NULL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
if (compflags != NULL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! STRCPY(p, compflags);
|
|
Karsten Hopp |
1b117f |
! STRCAT(p, "/");
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
- STRCAT(p, items[1]);
|
|
Karsten Hopp |
1b117f |
- compflags = p;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
|
Karsten Hopp |
1b117f |
--- 5479,5503 ----
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! /* Don't use the first rule if it is a number. */
|
|
Karsten Hopp |
1b117f |
! if (compflags != NULL || *skipdigits(items[1]) != NUL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
+ /* Concatenate this string to previously defined ones,
|
|
Karsten Hopp |
1b117f |
+ * using a slash to separate them. */
|
|
Karsten Hopp |
1b117f |
+ l = (int)STRLEN(items[1]) + 1;
|
|
Karsten Hopp |
1b117f |
if (compflags != NULL)
|
|
Karsten Hopp |
1b117f |
+ l += (int)STRLEN(compflags) + 1;
|
|
Karsten Hopp |
1b117f |
+ p = getroom(spin, l, FALSE);
|
|
Karsten Hopp |
1b117f |
+ if (p != NULL)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (compflags != NULL)
|
|
Karsten Hopp |
1b117f |
! {
|
|
Karsten Hopp |
1b117f |
! STRCPY(p, compflags);
|
|
Karsten Hopp |
1b117f |
! STRCAT(p, "/");
|
|
Karsten Hopp |
1b117f |
! }
|
|
Karsten Hopp |
1b117f |
! STRCAT(p, items[1]);
|
|
Karsten Hopp |
1b117f |
! compflags = p;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 6291,6297 ****
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
for (p = compflags; *p != NUL; )
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (vim_strchr((char_u *)"/*+[]", *p) != NULL)
|
|
Karsten Hopp |
1b117f |
/* Copy non-flag characters directly. */
|
|
Karsten Hopp |
1b117f |
*tp++ = *p++;
|
|
Karsten Hopp |
1b117f |
else
|
|
Karsten Hopp |
1b117f |
--- 6297,6303 ----
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
for (p = compflags; *p != NUL; )
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (vim_strchr((char_u *)"/?*+[]", *p) != NULL)
|
|
Karsten Hopp |
1b117f |
/* Copy non-flag characters directly. */
|
|
Karsten Hopp |
1b117f |
*tp++ = *p++;
|
|
Karsten Hopp |
1b117f |
else
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 6320,6326 ****
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
check_renumber(spin);
|
|
Karsten Hopp |
1b117f |
id = spin->si_newcompID--;
|
|
Karsten Hopp |
1b117f |
! } while (vim_strchr((char_u *)"/+*[]\\-^", id) != NULL);
|
|
Karsten Hopp |
1b117f |
ci->ci_newID = id;
|
|
Karsten Hopp |
1b117f |
hash_add(&aff->af_comp, ci->ci_key);
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
--- 6326,6332 ----
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
check_renumber(spin);
|
|
Karsten Hopp |
1b117f |
id = spin->si_newcompID--;
|
|
Karsten Hopp |
1b117f |
! } while (vim_strchr((char_u *)"/?*+[]\\-^", id) != NULL);
|
|
Karsten Hopp |
1b117f |
ci->ci_newID = id;
|
|
Karsten Hopp |
1b117f |
hash_add(&aff->af_comp, ci->ci_key);
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 7364,7373 ****
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
if (bl == NULL || bl->sb_used + len > SBLOCKSIZE)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! /* Allocate a block of memory. This is not freed until much later. */
|
|
Karsten Hopp |
1b117f |
! bl = (sblock_T *)alloc_clear((unsigned)(sizeof(sblock_T) + SBLOCKSIZE));
|
|
Karsten Hopp |
1b117f |
if (bl == NULL)
|
|
Karsten Hopp |
1b117f |
return NULL;
|
|
Karsten Hopp |
1b117f |
bl->sb_next = spin->si_blocks;
|
|
Karsten Hopp |
1b117f |
spin->si_blocks = bl;
|
|
Karsten Hopp |
1b117f |
bl->sb_used = 0;
|
|
Karsten Hopp |
1b117f |
--- 7370,7390 ----
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
if (bl == NULL || bl->sb_used + len > SBLOCKSIZE)
|
|
Karsten Hopp |
1b117f |
{
|
|
Karsten Hopp |
1b117f |
! if (len >= SBLOCKSIZE)
|
|
Karsten Hopp |
1b117f |
! bl = NULL;
|
|
Karsten Hopp |
1b117f |
! else
|
|
Karsten Hopp |
1b117f |
! /* Allocate a block of memory. It is not freed until much later. */
|
|
Karsten Hopp |
1b117f |
! bl = (sblock_T *)alloc_clear(
|
|
Karsten Hopp |
1b117f |
! (unsigned)(sizeof(sblock_T) + SBLOCKSIZE));
|
|
Karsten Hopp |
1b117f |
if (bl == NULL)
|
|
Karsten Hopp |
1b117f |
+ {
|
|
Karsten Hopp |
1b117f |
+ if (!spin->si_did_emsg)
|
|
Karsten Hopp |
1b117f |
+ {
|
|
Karsten Hopp |
1b117f |
+ EMSG(_("E845: Insufficient memory, word list will be incomplete"));
|
|
Karsten Hopp |
1b117f |
+ spin->si_did_emsg = TRUE;
|
|
Karsten Hopp |
1b117f |
+ }
|
|
Karsten Hopp |
1b117f |
return NULL;
|
|
Karsten Hopp |
1b117f |
+ }
|
|
Karsten Hopp |
1b117f |
bl->sb_next = spin->si_blocks;
|
|
Karsten Hopp |
1b117f |
spin->si_blocks = bl;
|
|
Karsten Hopp |
1b117f |
bl->sb_used = 0;
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 7382,7387 ****
|
|
Karsten Hopp |
1b117f |
--- 7399,7405 ----
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
/*
|
|
Karsten Hopp |
1b117f |
* Make a copy of a string into memory allocated with getroom().
|
|
Karsten Hopp |
1b117f |
+ * Returns NULL when out of memory.
|
|
Karsten Hopp |
1b117f |
*/
|
|
Karsten Hopp |
1b117f |
static char_u *
|
|
Karsten Hopp |
1b117f |
getroom_save(spin, s)
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 7416,7421 ****
|
|
Karsten Hopp |
1b117f |
--- 7434,7440 ----
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
/*
|
|
Karsten Hopp |
1b117f |
* Allocate the root of a word tree.
|
|
Karsten Hopp |
1b117f |
+ * Returns NULL when out of memory.
|
|
Karsten Hopp |
1b117f |
*/
|
|
Karsten Hopp |
1b117f |
static wordnode_T *
|
|
Karsten Hopp |
1b117f |
wordtree_alloc(spin)
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 7700,7705 ****
|
|
Karsten Hopp |
1b117f |
--- 7719,7725 ----
|
|
Karsten Hopp |
1b117f |
/*
|
|
Karsten Hopp |
1b117f |
* Get a wordnode_T, either from the list of previously freed nodes or
|
|
Karsten Hopp |
1b117f |
* allocate a new one.
|
|
Karsten Hopp |
1b117f |
+ * Returns NULL when out of memory.
|
|
Karsten Hopp |
1b117f |
*/
|
|
Karsten Hopp |
1b117f |
static wordnode_T *
|
|
Karsten Hopp |
1b117f |
get_wordnode(spin)
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 7717,7723 ****
|
|
Karsten Hopp |
1b117f |
--spin->si_free_count;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
#ifdef SPELL_PRINTTREE
|
|
Karsten Hopp |
1b117f |
! n->wn_nr = ++spin->si_wordnode_nr;
|
|
Karsten Hopp |
1b117f |
#endif
|
|
Karsten Hopp |
1b117f |
return n;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
--- 7737,7744 ----
|
|
Karsten Hopp |
1b117f |
--spin->si_free_count;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
#ifdef SPELL_PRINTTREE
|
|
Karsten Hopp |
1b117f |
! if (n != NULL)
|
|
Karsten Hopp |
1b117f |
! n->wn_nr = ++spin->si_wordnode_nr;
|
|
Karsten Hopp |
1b117f |
#endif
|
|
Karsten Hopp |
1b117f |
return n;
|
|
Karsten Hopp |
1b117f |
}
|
|
Karsten Hopp |
1b117f |
*** ../vim-7.3.108/src/version.c 2011-02-01 13:48:47.000000000 +0100
|
|
Karsten Hopp |
1b117f |
--- src/version.c 2011-02-01 13:56:38.000000000 +0100
|
|
Karsten Hopp |
1b117f |
***************
|
|
Karsten Hopp |
1b117f |
*** 716,717 ****
|
|
Karsten Hopp |
1b117f |
--- 716,719 ----
|
|
Karsten Hopp |
1b117f |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
1b117f |
+ /**/
|
|
Karsten Hopp |
1b117f |
+ 109,
|
|
Karsten Hopp |
1b117f |
/**/
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
--
|
|
Karsten Hopp |
1b117f |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
1b117f |
174. You know what a listserv is.
|
|
Karsten Hopp |
1b117f |
|
|
Karsten Hopp |
1b117f |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
1b117f |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
1b117f |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
1b117f |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|