]>
Commit | Line | Data |
---|---|---|
ef75664d AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.251 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.251 | |
11 | Problem: Using freed memory when spell checking enabled. | |
12 | Solution: Obtain the current line again after calling spell_move_to(). | |
13 | (Dominique Pelle) | |
14 | Files: src/screen.c | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 2644,2650 **** | |
21 | #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ | |
22 | || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) | |
23 | # define LINE_ATTR | |
24 | ! int line_attr = 0; /* atrribute for the whole line */ | |
25 | #endif | |
26 | #ifdef FEAT_SEARCH_EXTRA | |
27 | matchitem_T *cur; /* points to the match list */ | |
28 | --- 2644,2650 ---- | |
29 | #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ | |
30 | || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) | |
31 | # define LINE_ATTR | |
32 | ! int line_attr = 0; /* attribute for the whole line */ | |
33 | #endif | |
34 | #ifdef FEAT_SEARCH_EXTRA | |
35 | matchitem_T *cur; /* points to the match list */ | |
36 | *************** | |
37 | *** 3040,3057 **** | |
38 | if (has_spell) | |
39 | { | |
40 | int len; | |
41 | hlf_T spell_hlf = HLF_COUNT; | |
42 | ||
43 | pos = wp->w_cursor; | |
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) | |
48 | { | |
49 | /* no bad word found at line start, don't check until end of a | |
50 | * word */ | |
51 | spell_hlf = HLF_COUNT; | |
52 | ! word_end = (int)(spell_to_word_end(ptr, wp->w_buffer) - line + 1); | |
53 | } | |
54 | else | |
55 | { | |
56 | --- 3040,3064 ---- | |
57 | if (has_spell) | |
58 | { | |
59 | int len; | |
60 | + colnr_T linecol = (colnr_T)(ptr - line); | |
61 | hlf_T spell_hlf = HLF_COUNT; | |
62 | ||
63 | pos = wp->w_cursor; | |
64 | wp->w_cursor.lnum = lnum; | |
65 | ! wp->w_cursor.col = linecol; | |
66 | len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf); | |
67 | + | |
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; | |
71 | + | |
72 | if (len == 0 || (int)wp->w_cursor.col > ptr - line) | |
73 | { | |
74 | /* no bad word found at line start, don't check until end of a | |
75 | * word */ | |
76 | spell_hlf = HLF_COUNT; | |
77 | ! word_end = (int)(spell_to_word_end(ptr, wp->w_buffer) | |
78 | ! - line + 1); | |
79 | } | |
80 | else | |
81 | { | |
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 | |
84 | *************** | |
85 | *** 668,669 **** | |
86 | --- 668,671 ---- | |
87 | { /* Add new patch number below this line */ | |
88 | + /**/ | |
89 | + 251, | |
90 | /**/ | |
91 | ||
92 | -- | |
93 | How To Keep A Healthy Level Of Insanity: | |
94 | 6. In the memo field of all your checks, write "for sexual favors". | |
95 | ||
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 /// |