4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
10 Patch 7.2.435 (after 7.2.430)
11 Problem: Crash when using bad_char_idx uninitialized. (Patrick Texier)
12 Solution: Don't use bad_char_idx, reproduce the ++bad argument from bad_char.
13 Files: src/eval.c, src/ex_cmds.h, src/ex_docmd.c
16 *** ../vim-7.2.434/src/eval.c 2010-05-14 20:41:00.000000000 +0200
17 --- src/eval.c 2010-05-16 13:19:04.000000000 +0200
21 if (eap->force_enc != 0)
22 len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
23 ! if (eap->bad_char_idx != 0)
24 ! len += (unsigned)STRLEN(eap->cmd + eap->bad_char_idx) + 7;
27 newval = alloc(len + 1);
30 if (eap->force_enc != 0)
31 len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
32 ! if (eap->bad_char != 0)
33 ! len += 7 + 4; /* " ++bad=" + "keep" or "drop" */
36 newval = alloc(len + 1);
39 if (eap->force_enc != 0)
40 sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
41 eap->cmd + eap->force_enc);
42 ! if (eap->bad_char_idx != 0)
43 ! sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
44 ! eap->cmd + eap->bad_char_idx);
46 vimvars[VV_CMDARG].vv_str = newval;
49 if (eap->force_enc != 0)
50 sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
51 eap->cmd + eap->force_enc);
52 ! if (eap->bad_char == BAD_KEEP)
53 ! STRCPY(newval + STRLEN(newval), " ++bad=keep");
54 ! else if (eap->bad_char == BAD_DROP)
55 ! STRCPY(newval + STRLEN(newval), " ++bad=drop");
56 ! else if (eap->bad_char != 0)
57 ! sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char);
59 vimvars[VV_CMDARG].vv_str = newval;
61 *** ../vim-7.2.434/src/ex_cmds.h 2010-05-14 20:41:00.000000000 +0200
62 --- src/ex_cmds.h 2010-05-16 13:03:53.000000000 +0200
65 int force_ff; /* ++ff= argument (index in cmd[]) */
67 int force_enc; /* ++enc= argument (index in cmd[]) */
68 ! int bad_char_idx; /* ++bad= argument (index in cmd[]) */
69 ! int bad_char; /* BAD_KEEP, BAD_DROP or replacement char */
72 int useridx; /* user command index */
74 int force_ff; /* ++ff= argument (index in cmd[]) */
76 int force_enc; /* ++enc= argument (index in cmd[]) */
77 ! int bad_char; /* BAD_KEEP, BAD_DROP or replacement byte */
80 int useridx; /* user command index */
81 *** ../vim-7.2.434/src/ex_docmd.c 2010-05-14 20:41:00.000000000 +0200
82 --- src/ex_docmd.c 2010-05-16 13:13:30.000000000 +0200
86 char_u *arg = eap->arg + 2;
95 else if (STRNCMP(arg, "bad", 3) == 0)
98 ! pp = &eap->bad_char_idx;
103 else if (STRNCMP(arg, "bad", 3) == 0)
106 ! pp = &bad_char_idx;
113 /* Check ++bad= argument. Must be a single-byte character, "keep" or
115 ! p = eap->cmd + eap->bad_char_idx;
116 if (STRICMP(p, "keep") == 0)
117 eap->bad_char = BAD_KEEP;
118 else if (STRICMP(p, "drop") == 0)
121 /* Check ++bad= argument. Must be a single-byte character, "keep" or
123 ! p = eap->cmd + bad_char_idx;
124 if (STRICMP(p, "keep") == 0)
125 eap->bad_char = BAD_KEEP;
126 else if (STRICMP(p, "drop") == 0)
127 *** ../vim-7.2.434/src/version.c 2010-05-16 12:32:37.000000000 +0200
128 --- src/version.c 2010-05-16 13:24:39.000000000 +0200
132 { /* Add new patch number below this line */
138 hundred-and-one symptoms of being an internet addict:
139 45. You buy a Captain Kirk chair with a built-in keyboard and mouse.
141 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
142 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
143 \\\ download, build and distribute -- http://www.A-A-P.org ///
144 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///