]>
Commit | Line | Data |
---|---|---|
9512a71a AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.113 | |
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.2.113 | |
11 | Problem: Crash for substitute() call using submatch(1) while there is no | |
12 | such submatch. (Yukihiro Nakadaira) | |
13 | Solution: Also check the start of the submatch is set, it can be NULL when | |
14 | an attempted match didn't work out. | |
15 | Files: src/regexp.c | |
16 | ||
17 | ||
18 | *** ../vim-7.2.112/src/regexp.c Fri Aug 8 13:45:31 2008 | |
19 | --- src/regexp.c Sat Feb 21 21:46:49 2009 | |
20 | *************** | |
21 | *** 4532,4538 **** | |
22 | cleanup_subexpr(); | |
23 | if (!REG_MULTI) /* Single-line regexp */ | |
24 | { | |
25 | ! if (reg_endp[no] == NULL) | |
26 | { | |
27 | /* Backref was not set: Match an empty string. */ | |
28 | len = 0; | |
29 | --- 4532,4538 ---- | |
30 | cleanup_subexpr(); | |
31 | if (!REG_MULTI) /* Single-line regexp */ | |
32 | { | |
33 | ! if (reg_startp[no] == NULL || reg_endp[no] == NULL) | |
34 | { | |
35 | /* Backref was not set: Match an empty string. */ | |
36 | len = 0; | |
37 | *************** | |
38 | *** 4548,4554 **** | |
39 | } | |
40 | else /* Multi-line regexp */ | |
41 | { | |
42 | ! if (reg_endpos[no].lnum < 0) | |
43 | { | |
44 | /* Backref was not set: Match an empty string. */ | |
45 | len = 0; | |
46 | --- 4548,4554 ---- | |
47 | } | |
48 | else /* Multi-line regexp */ | |
49 | { | |
50 | ! if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0) | |
51 | { | |
52 | /* Backref was not set: Match an empty string. */ | |
53 | len = 0; | |
54 | *************** | |
55 | *** 7279,7291 **** | |
56 | } | |
57 | else | |
58 | { | |
59 | ! if (submatch_match->endp[no] == NULL) | |
60 | retval = NULL; | |
61 | else | |
62 | - { | |
63 | - s = submatch_match->startp[no]; | |
64 | retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s)); | |
65 | - } | |
66 | } | |
67 | ||
68 | return retval; | |
69 | --- 7279,7289 ---- | |
70 | } | |
71 | else | |
72 | { | |
73 | ! s = submatch_match->startp[no]; | |
74 | ! if (s == NULL || submatch_match->endp[no] == NULL) | |
75 | retval = NULL; | |
76 | else | |
77 | retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s)); | |
78 | } | |
79 | ||
80 | return retval; | |
81 | *** ../vim-7.2.112/src/version.c Sat Feb 21 21:22:44 2009 | |
82 | --- src/version.c Sat Feb 21 22:01:56 2009 | |
83 | *************** | |
84 | *** 678,679 **** | |
85 | --- 678,681 ---- | |
86 | { /* Add new patch number below this line */ | |
87 | + /**/ | |
88 | + 113, | |
89 | /**/ | |
90 | ||
91 | -- | |
92 | hundred-and-one symptoms of being an internet addict: | |
93 | 103. When you find yourself in the "Computer" section of Barnes & Noble | |
94 | enjoying yourself. | |
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 /// |