4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Using freed memory when spell checking enabled.
12 Solution: Obtain the current line again after calling spell_move_to().
17 *** ../vim-7.1.250/src/screen.c Sat Jan 19 15:55:51 2008
18 --- src/screen.c Wed Feb 13 21:45:38 2008
21 #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
22 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
24 ! int line_attr = 0; /* atrribute for the whole line */
26 #ifdef FEAT_SEARCH_EXTRA
27 matchitem_T *cur; /* points to the match list */
29 #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
30 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
32 ! int line_attr = 0; /* attribute for the whole line */
34 #ifdef FEAT_SEARCH_EXTRA
35 matchitem_T *cur; /* points to the match list */
41 hlf_T spell_hlf = HLF_COUNT;
44 wp->w_cursor.lnum = lnum;
45 ! wp->w_cursor.col = (colnr_T)(ptr - line);
46 len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
47 if (len == 0 || (int)wp->w_cursor.col > ptr - line)
49 /* no bad word found at line start, don't check until end of a
51 spell_hlf = HLF_COUNT;
52 ! word_end = (int)(spell_to_word_end(ptr, wp->w_buffer) - line + 1);
60 + colnr_T linecol = (colnr_T)(ptr - line);
61 hlf_T spell_hlf = HLF_COUNT;
64 wp->w_cursor.lnum = lnum;
65 ! wp->w_cursor.col = linecol;
66 len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
68 + /* spell_move_to() may call ml_get() and make "line" invalid */
69 + line = ml_get_buf(wp->w_buffer, lnum, FALSE);
70 + ptr = line + linecol;
72 if (len == 0 || (int)wp->w_cursor.col > ptr - line)
74 /* no bad word found at line start, don't check until end of a
76 spell_hlf = HLF_COUNT;
77 ! word_end = (int)(spell_to_word_end(ptr, wp->w_buffer)
82 *** ../vim-7.1.250/src/version.c Wed Feb 13 18:35:23 2008
83 --- src/version.c Wed Feb 13 21:48:08 2008
87 { /* Add new patch number below this line */
93 How To Keep A Healthy Level Of Insanity:
94 6. In the memo field of all your checks, write "for sexual favors".
96 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
97 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
98 \\\ download, build and distribute -- http://www.A-A-P.org ///
99 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///