073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.402
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.402
073263
Problem:    Test 72 crashes under certain conditions. (Kazunobu Kuriyama)
073263
Solution:   Clear the whole bufinfo_T early.
073263
Files:	    src/undo.c
073263
073263
073263
*** ../vim-7.4.401/src/undo.c	2014-08-10 13:34:59.064785459 +0200
073263
--- src/undo.c	2014-08-12 20:08:23.915373819 +0200
073263
***************
073263
*** 929,935 ****
073263
  undo_flush(bi)
073263
      bufinfo_T	*bi;
073263
  {
073263
!     if (bi->bi_used > 0)
073263
      {
073263
  	crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
073263
  	if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)
073263
--- 929,935 ----
073263
  undo_flush(bi)
073263
      bufinfo_T	*bi;
073263
  {
073263
!     if (bi->bi_buffer != NULL && bi->bi_used > 0)
073263
      {
073263
  	crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
073263
  	if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)
073263
***************
073263
*** 1573,1582 ****
073263
  #endif
073263
      bufinfo_T	bi;
073263
  
073263
! #ifdef FEAT_CRYPT
073263
!     bi.bi_state = NULL;
073263
!     bi.bi_buffer = NULL;
073263
! #endif
073263
  
073263
      if (name == NULL)
073263
      {
073263
--- 1573,1579 ----
073263
  #endif
073263
      bufinfo_T	bi;
073263
  
073263
!     vim_memset(&bi, 0, sizeof(bi));
073263
  
073263
      if (name == NULL)
073263
      {
073263
***************
073263
*** 1861,1866 ****
073263
--- 1858,1864 ----
073263
  #endif
073263
      bufinfo_T	bi;
073263
  
073263
+     vim_memset(&bi, 0, sizeof(bi));
073263
      if (name == NULL)
073263
      {
073263
  	file_name = u_get_undo_file_name(curbuf->b_ffname, TRUE);
073263
***************
073263
*** 1905,1914 ****
073263
      }
073263
      bi.bi_buf = curbuf;
073263
      bi.bi_fp = fp;
073263
- #ifdef FEAT_CRYPT
073263
-     bi.bi_state = NULL;
073263
-     bi.bi_buffer = NULL;
073263
- #endif
073263
  
073263
      /*
073263
       * Read the undo file header.
073263
--- 1903,1908 ----
073263
*** ../vim-7.4.401/src/version.c	2014-08-10 16:31:47.376709213 +0200
073263
--- src/version.c	2014-08-12 20:11:13.879372598 +0200
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     402,
073263
  /**/
073263
073263
-- 
073263
Far back in the mists of ancient time, in the great and glorious days of the
073263
former Galactic Empire, life was wild, rich and largely tax free.
073263
Mighty starships plied their way between exotic suns, seeking adventure and
073263
reward among the furthest reaches of Galactic space.  In those days, spirits
073263
were brave, the stakes were high, men were real men, women were real women
073263
and small furry creatures from Alpha Centauri were real small furry creatures
073263
from Alpha Centauri.  And all dared to brave unknown terrors, to do mighty
073263
deeds, to boldly split infinitives that no man had split before -- and thus
073263
was the Empire forged.
073263
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///