home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.2 / 7.2.435 < prev    next >
Encoding:
Internet Message Format  |  2010-05-15  |  4.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.435
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  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
  14.  
  15.  
  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
  18. ***************
  19. *** 18309,18316 ****
  20.   # ifdef FEAT_MBYTE
  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;
  25.   # endif
  26.   
  27.       newval = alloc(len + 1);
  28. --- 18309,18316 ----
  29.   # ifdef FEAT_MBYTE
  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" */
  34.   # endif
  35.   
  36.       newval = alloc(len + 1);
  37. ***************
  38. *** 18334,18342 ****
  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);
  45.   # endif
  46.       vimvars[VV_CMDARG].vv_str = newval;
  47.       return oldval;
  48. --- 18334,18345 ----
  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);
  58.   # endif
  59.       vimvars[VV_CMDARG].vv_str = newval;
  60.       return oldval;
  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
  63. ***************
  64. *** 1152,1159 ****
  65.       int        force_ff;    /* ++ff= argument (index in cmd[]) */
  66.   #ifdef FEAT_MBYTE
  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 */
  70.   #endif
  71.   #ifdef FEAT_USR_CMDS
  72.       int        useridx;    /* user command index */
  73. --- 1152,1158 ----
  74.       int        force_ff;    /* ++ff= argument (index in cmd[]) */
  75.   #ifdef FEAT_MBYTE
  76.       int        force_enc;    /* ++enc= argument (index in cmd[]) */
  77. !     int        bad_char;    /* BAD_KEEP, BAD_DROP or replacement byte */
  78.   #endif
  79.   #ifdef FEAT_USR_CMDS
  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
  83. ***************
  84. *** 4688,4693 ****
  85. --- 4688,4694 ----
  86.       char_u    *arg = eap->arg + 2;
  87.       int        *pp = NULL;
  88.   #ifdef FEAT_MBYTE
  89. +     int        bad_char_idx;
  90.       char_u    *p;
  91.   #endif
  92.   
  93. ***************
  94. *** 4739,4745 ****
  95.       else if (STRNCMP(arg, "bad", 3) == 0)
  96.       {
  97.       arg += 3;
  98. !     pp = &eap->bad_char_idx;
  99.       }
  100.   #endif
  101.   
  102. --- 4740,4746 ----
  103.       else if (STRNCMP(arg, "bad", 3) == 0)
  104.       {
  105.       arg += 3;
  106. !     pp = &bad_char_idx;
  107.       }
  108.   #endif
  109.   
  110. ***************
  111. *** 4770,4776 ****
  112.       {
  113.       /* Check ++bad= argument.  Must be a single-byte character, "keep" or
  114.        * "drop". */
  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)
  119. --- 4771,4777 ----
  120.       {
  121.       /* Check ++bad= argument.  Must be a single-byte character, "keep" or
  122.        * "drop". */
  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
  129. ***************
  130. *** 683,684 ****
  131. --- 683,686 ----
  132.   {   /* Add new patch number below this line */
  133. + /**/
  134. +     435,
  135.   /**/
  136.  
  137. -- 
  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.
  140.  
  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    ///
  145.