components/vim/vim72-patches/7.2.435
changeset 198 172fc01ce997
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/vim/vim72-patches/7.2.435	Thu Apr 07 16:25:07 2011 -0700
@@ -0,0 +1,144 @@
+To: [email protected]
+Subject: Patch 7.2.435
+Fcc: outbox
+From: Bram Moolenaar <[email protected]>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.2.435 (after 7.2.430)
+Problem:    Crash when using bad_char_idx uninitialized. (Patrick Texier)
+Solution:   Don't use bad_char_idx, reproduce the ++bad argument from bad_char.
+Files:	    src/eval.c, src/ex_cmds.h, src/ex_docmd.c
+
+
+*** ../vim-7.2.434/src/eval.c	2010-05-14 20:41:00.000000000 +0200
+--- src/eval.c	2010-05-16 13:19:04.000000000 +0200
+***************
+*** 18309,18316 ****
+  # ifdef FEAT_MBYTE
+      if (eap->force_enc != 0)
+  	len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
+!     if (eap->bad_char_idx != 0)
+! 	len += (unsigned)STRLEN(eap->cmd + eap->bad_char_idx) + 7;
+  # endif
+  
+      newval = alloc(len + 1);
+--- 18309,18316 ----
+  # ifdef FEAT_MBYTE
+      if (eap->force_enc != 0)
+  	len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
+!     if (eap->bad_char != 0)
+! 	len += 7 + 4;  /* " ++bad=" + "keep" or "drop" */
+  # endif
+  
+      newval = alloc(len + 1);
+***************
+*** 18334,18342 ****
+      if (eap->force_enc != 0)
+  	sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
+  					       eap->cmd + eap->force_enc);
+!     if (eap->bad_char_idx != 0)
+! 	sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
+! 					       eap->cmd + eap->bad_char_idx);
+  # endif
+      vimvars[VV_CMDARG].vv_str = newval;
+      return oldval;
+--- 18334,18345 ----
+      if (eap->force_enc != 0)
+  	sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
+  					       eap->cmd + eap->force_enc);
+!     if (eap->bad_char == BAD_KEEP)
+! 	STRCPY(newval + STRLEN(newval), " ++bad=keep");
+!     else if (eap->bad_char == BAD_DROP)
+! 	STRCPY(newval + STRLEN(newval), " ++bad=drop");
+!     else if (eap->bad_char != 0)
+! 	sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char);
+  # endif
+      vimvars[VV_CMDARG].vv_str = newval;
+      return oldval;
+*** ../vim-7.2.434/src/ex_cmds.h	2010-05-14 20:41:00.000000000 +0200
+--- src/ex_cmds.h	2010-05-16 13:03:53.000000000 +0200
+***************
+*** 1152,1159 ****
+      int		force_ff;	/* ++ff= argument (index in cmd[]) */
+  #ifdef FEAT_MBYTE
+      int		force_enc;	/* ++enc= argument (index in cmd[]) */
+!     int		bad_char_idx;	/* ++bad= argument (index in cmd[]) */
+!     int		bad_char;	/* BAD_KEEP, BAD_DROP or replacement char */
+  #endif
+  #ifdef FEAT_USR_CMDS
+      int		useridx;	/* user command index */
+--- 1152,1158 ----
+      int		force_ff;	/* ++ff= argument (index in cmd[]) */
+  #ifdef FEAT_MBYTE
+      int		force_enc;	/* ++enc= argument (index in cmd[]) */
+!     int		bad_char;	/* BAD_KEEP, BAD_DROP or replacement byte */
+  #endif
+  #ifdef FEAT_USR_CMDS
+      int		useridx;	/* user command index */
+*** ../vim-7.2.434/src/ex_docmd.c	2010-05-14 20:41:00.000000000 +0200
+--- src/ex_docmd.c	2010-05-16 13:13:30.000000000 +0200
+***************
+*** 4688,4693 ****
+--- 4688,4694 ----
+      char_u	*arg = eap->arg + 2;
+      int		*pp = NULL;
+  #ifdef FEAT_MBYTE
++     int		bad_char_idx;
+      char_u	*p;
+  #endif
+  
+***************
+*** 4739,4745 ****
+      else if (STRNCMP(arg, "bad", 3) == 0)
+      {
+  	arg += 3;
+! 	pp = &eap->bad_char_idx;
+      }
+  #endif
+  
+--- 4740,4746 ----
+      else if (STRNCMP(arg, "bad", 3) == 0)
+      {
+  	arg += 3;
+! 	pp = &bad_char_idx;
+      }
+  #endif
+  
+***************
+*** 4770,4776 ****
+      {
+  	/* Check ++bad= argument.  Must be a single-byte character, "keep" or
+  	 * "drop". */
+! 	p = eap->cmd + eap->bad_char_idx;
+  	if (STRICMP(p, "keep") == 0)
+  	    eap->bad_char = BAD_KEEP;
+  	else if (STRICMP(p, "drop") == 0)
+--- 4771,4777 ----
+      {
+  	/* Check ++bad= argument.  Must be a single-byte character, "keep" or
+  	 * "drop". */
+! 	p = eap->cmd + bad_char_idx;
+  	if (STRICMP(p, "keep") == 0)
+  	    eap->bad_char = BAD_KEEP;
+  	else if (STRICMP(p, "drop") == 0)
+*** ../vim-7.2.434/src/version.c	2010-05-16 12:32:37.000000000 +0200
+--- src/version.c	2010-05-16 13:24:39.000000000 +0200
+***************
+*** 683,684 ****
+--- 683,686 ----
+  {   /* Add new patch number below this line */
++ /**/
++     435,
+  /**/
+
+-- 
+hundred-and-one symptoms of being an internet addict:
+45. You buy a Captain Kirk chair with a built-in keyboard and mouse.
+
+ /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\        download, build and distribute -- http://www.A-A-P.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///