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 / old / 5.5.068 < prev    next >
Encoding:
Internet Message Format  |  1999-12-13  |  3.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.5.068
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.068
  8. Problem:    Crash when a ":while" is used with an argument that has an error.
  9.             (Sylvain Viart)
  10. Solution:   Was using an uninitialized index in the cs_line[] array.  The
  11.             crash only happened when the index was far off.  Made sure the
  12.             uninitialized index isn't used.
  13. Files:      src/ex_docmd.c
  14.  
  15.  
  16. *** ../vim-5.5.67/src/ex_docmd.c    Wed Dec  8 12:52:43 1999
  17. --- src/ex_docmd.c    Fri Dec 10 12:33:50 1999
  18. ***************
  19. *** 520,527 ****
  20.           else
  21.               cstack.cs_had_continue = FALSE;
  22.   
  23. !         /* jump back to the matching ":while"? */
  24. !         if (!did_emsg && cstack.cs_idx >= 0
  25.               && (cstack.cs_flags[cstack.cs_idx] & CSF_ACTIVE))
  26.           {
  27.               current_line = cstack.cs_line[cstack.cs_idx];
  28. --- 520,532 ----
  29.           else
  30.               cstack.cs_had_continue = FALSE;
  31.   
  32. !         /* Jump back to the matching ":while".  Be careful not to use
  33. !          * a cs_line[] from an entry that isn't a ":while": It would
  34. !          * make "current_line" invalid and can cause a crash. */
  35. !         if (!did_emsg
  36. !             && cstack.cs_idx >= 0
  37. !             && (cstack.cs_flags[cstack.cs_idx] & CSF_WHILE)
  38. !             && cstack.cs_line[cstack.cs_idx] >= 0
  39.               && (cstack.cs_flags[cstack.cs_idx] & CSF_ACTIVE))
  40.           {
  41.               current_line = cstack.cs_line[cstack.cs_idx];
  42. ***************
  43. *** 7233,7238 ****
  44. --- 7238,7244 ----
  45.       {
  46.           ++cstack->cs_idx;
  47.           ++cstack->cs_whilelevel;
  48. +         cstack->cs_line[cstack->cs_idx] = -1;
  49.       }
  50.       cstack->cs_flags[cstack->cs_idx] = CSF_WHILE;
  51.   
  52. ***************
  53. *** 7246,7261 ****
  54.   
  55.       if (!skip)
  56.       {
  57. !         if (result)
  58.           cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE;
  59. !         if (error)
  60. !         --cstack->cs_idx;
  61. !         else
  62. !         /*
  63. !          * Set cs_had_while flag, so do_cmdline() will set the line
  64. !          * number in cs_line[].
  65. !          */
  66. !         cstack->cs_had_while = TRUE;
  67.       }
  68.       }
  69.   
  70. --- 7252,7264 ----
  71.   
  72.       if (!skip)
  73.       {
  74. !         if (result && !error)
  75.           cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE;
  76. !         /*
  77. !          * Set cs_had_while flag, so do_cmdline() will set the line
  78. !          * number in cs_line[].
  79. !          */
  80. !         cstack->cs_had_while = TRUE;
  81.       }
  82.       }
  83.   
  84. ***************
  85. *** 7332,7338 ****
  86.       if (!(cstack->cs_flags[cstack->cs_idx] & CSF_WHILE))
  87.       {
  88.           errormsg = (char_u *)":endwhile without :while";
  89. !         while (cstack->cs_idx > 0
  90.               && !(cstack->cs_flags[cstack->cs_idx] & CSF_WHILE))
  91.           --cstack->cs_idx;
  92.       }
  93. --- 7335,7341 ----
  94.       if (!(cstack->cs_flags[cstack->cs_idx] & CSF_WHILE))
  95.       {
  96.           errormsg = (char_u *)":endwhile without :while";
  97. !         while (cstack->cs_idx >= 0
  98.               && !(cstack->cs_flags[cstack->cs_idx] & CSF_WHILE))
  99.           --cstack->cs_idx;
  100.       }
  101. *** ../vim-5.5.67/src/version.c    Thu Dec  9 13:11:45 1999
  102. --- src/version.c    Fri Dec 10 12:42:46 1999
  103. ***************
  104. *** 420,420 ****
  105. --- 420,421 ----
  106.   {   /* Add new patch number below this line */
  107. +     68,
  108.  
  109. -- 
  110. ARTHUR:    Well, it doesn't matter.  Will you go and tell your master that
  111.            Arthur from the Court of Camelot is here.
  112. GUARD #1:  Listen, in order to maintain air-speed velocity, a swallow
  113.            needs to beat its wings 43 times every second, right?
  114. ARTHUR:    Please!
  115.                                   The Quest for the Holy Grail (Monty Python)
  116.  
  117. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  118.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  119.