components/vim/vim72-patches/7.2.430
changeset 198 172fc01ce997
equal deleted inserted replaced
197:fd801ec0737c 198:172fc01ce997
       
     1 To: [email protected]
       
     2 Subject: Patch 7.2.430
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=UTF-8
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.430
       
    11 Problem:    The ++bad argument is handled wrong, resulting in an invalid
       
    12 	    memory access.
       
    13 Solution:   Use the bad_char field only for the replacement character, add
       
    14 	    bad_char_idx to store the position. (Dominique Pelle)
       
    15 Files:	    src/eval.c, src/ex_cmds.h, src/ex_docmd.c
       
    16 
       
    17 
       
    18 *** ../vim-7.2.429/src/eval.c	2010-05-14 12:16:19.000000000 +0200
       
    19 --- src/eval.c	2010-05-14 19:04:53.000000000 +0200
       
    20 ***************
       
    21 *** 18309,18316 ****
       
    22   # ifdef FEAT_MBYTE
       
    23       if (eap->force_enc != 0)
       
    24   	len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
       
    25 !     if (eap->bad_char != 0)
       
    26 ! 	len += (unsigned)STRLEN(eap->cmd + eap->bad_char) + 7;
       
    27   # endif
       
    28   
       
    29       newval = alloc(len + 1);
       
    30 --- 18309,18316 ----
       
    31   # ifdef FEAT_MBYTE
       
    32       if (eap->force_enc != 0)
       
    33   	len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
       
    34 !     if (eap->bad_char_idx != 0)
       
    35 ! 	len += (unsigned)STRLEN(eap->cmd + eap->bad_char_idx) + 7;
       
    36   # endif
       
    37   
       
    38       newval = alloc(len + 1);
       
    39 ***************
       
    40 *** 18334,18342 ****
       
    41       if (eap->force_enc != 0)
       
    42   	sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
       
    43   					       eap->cmd + eap->force_enc);
       
    44 !     if (eap->bad_char != 0)
       
    45   	sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
       
    46 ! 					       eap->cmd + eap->bad_char);
       
    47   # endif
       
    48       vimvars[VV_CMDARG].vv_str = newval;
       
    49       return oldval;
       
    50 --- 18334,18342 ----
       
    51       if (eap->force_enc != 0)
       
    52   	sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
       
    53   					       eap->cmd + eap->force_enc);
       
    54 !     if (eap->bad_char_idx != 0)
       
    55   	sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
       
    56 ! 					       eap->cmd + eap->bad_char_idx);
       
    57   # endif
       
    58       vimvars[VV_CMDARG].vv_str = newval;
       
    59       return oldval;
       
    60 *** ../vim-7.2.429/src/ex_cmds.h	2010-05-14 15:42:49.000000000 +0200
       
    61 --- src/ex_cmds.h	2010-05-14 20:23:20.000000000 +0200
       
    62 ***************
       
    63 *** 1152,1158 ****
       
    64       int		force_ff;	/* ++ff= argument (index in cmd[]) */
       
    65   #ifdef FEAT_MBYTE
       
    66       int		force_enc;	/* ++enc= argument (index in cmd[]) */
       
    67 !     int		bad_char;	/* ++bad= argument (index in cmd[]) */
       
    68   #endif
       
    69   #ifdef FEAT_USR_CMDS
       
    70       int		useridx;	/* user command index */
       
    71 --- 1152,1159 ----
       
    72       int		force_ff;	/* ++ff= argument (index in cmd[]) */
       
    73   #ifdef FEAT_MBYTE
       
    74       int		force_enc;	/* ++enc= argument (index in cmd[]) */
       
    75 !     int		bad_char_idx;	/* ++bad= argument (index in cmd[]) */
       
    76 !     int		bad_char;	/* BAD_KEEP, BAD_DROP or replacement char */
       
    77   #endif
       
    78   #ifdef FEAT_USR_CMDS
       
    79       int		useridx;	/* user command index */
       
    80 *** ../vim-7.2.429/src/ex_docmd.c	2010-05-14 15:28:37.000000000 +0200
       
    81 --- src/ex_docmd.c	2010-05-14 19:04:53.000000000 +0200
       
    82 ***************
       
    83 *** 4739,4745 ****
       
    84       else if (STRNCMP(arg, "bad", 3) == 0)
       
    85       {
       
    86   	arg += 3;
       
    87 ! 	pp = &eap->bad_char;
       
    88       }
       
    89   #endif
       
    90   
       
    91 --- 4739,4745 ----
       
    92       else if (STRNCMP(arg, "bad", 3) == 0)
       
    93       {
       
    94   	arg += 3;
       
    95 ! 	pp = &eap->bad_char_idx;
       
    96       }
       
    97   #endif
       
    98   
       
    99 ***************
       
   100 *** 4770,4776 ****
       
   101       {
       
   102   	/* Check ++bad= argument.  Must be a single-byte character, "keep" or
       
   103   	 * "drop". */
       
   104 ! 	p = eap->cmd + eap->bad_char;
       
   105   	if (STRICMP(p, "keep") == 0)
       
   106   	    eap->bad_char = BAD_KEEP;
       
   107   	else if (STRICMP(p, "drop") == 0)
       
   108 --- 4770,4776 ----
       
   109       {
       
   110   	/* Check ++bad= argument.  Must be a single-byte character, "keep" or
       
   111   	 * "drop". */
       
   112 ! 	p = eap->cmd + eap->bad_char_idx;
       
   113   	if (STRICMP(p, "keep") == 0)
       
   114   	    eap->bad_char = BAD_KEEP;
       
   115   	else if (STRICMP(p, "drop") == 0)
       
   116 *** ../vim-7.2.429/src/version.c	2010-05-14 18:56:33.000000000 +0200
       
   117 --- src/version.c	2010-05-14 20:39:38.000000000 +0200
       
   118 ***************
       
   119 *** 683,684 ****
       
   120 --- 683,686 ----
       
   121   {   /* Add new patch number below this line */
       
   122 + /**/
       
   123 +     430,
       
   124   /**/
       
   125 
       
   126 -- 
       
   127 You have the right to remain silent. Anything you say will be
       
   128 misquoted, then used against you.
       
   129 
       
   130  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
   131 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
   132 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
   133  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///