Karsten Hopp b70a64
To: vim-dev@vim.org
Karsten Hopp b70a64
Subject: Patch 7.2.406
Karsten Hopp b70a64
Fcc: outbox
Karsten Hopp b70a64
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp b70a64
Mime-Version: 1.0
Karsten Hopp b70a64
Content-Type: text/plain; charset=UTF-8
Karsten Hopp b70a64
Content-Transfer-Encoding: 8bit
Karsten Hopp b70a64
------------
Karsten Hopp b70a64
Karsten Hopp b70a64
Patch 7.2.406
Karsten Hopp b70a64
Problem:    Patch 7.2.119 introduces uninit mem read. (Dominique Pelle)
Karsten Hopp b70a64
Solution:   Only used ScreeenLinesC when ScreeenLinesUC is not zero. (Yukihiro
Karsten Hopp b70a64
	    Nakadaira)  Also clear ScreeenLinesC when allocating.
Karsten Hopp b70a64
Files:	    src/screen.c
Karsten Hopp b70a64
Karsten Hopp b70a64
Karsten Hopp b70a64
*** ../vim-7.2.405/src/screen.c	2010-03-23 13:56:53.000000000 +0100
Karsten Hopp b70a64
--- src/screen.c	2010-03-23 15:26:44.000000000 +0100
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 25,34 ****
Karsten Hopp b70a64
   * one character which occupies two display cells.
Karsten Hopp b70a64
   * For UTF-8 a multi-byte character is converted to Unicode and stored in
Karsten Hopp b70a64
   * ScreenLinesUC[].  ScreenLines[] contains the first byte only.  For an ASCII
Karsten Hopp b70a64
!  * character without composing chars ScreenLinesUC[] will be 0.  When the
Karsten Hopp b70a64
!  * character occupies two display cells the next byte in ScreenLines[] is 0.
Karsten Hopp b70a64
   * ScreenLinesC[][] contain up to 'maxcombine' composing characters
Karsten Hopp b70a64
!  * (drawn on top of the first character).  They are 0 when not used.
Karsten Hopp b70a64
   * ScreenLines2[] is only used for euc-jp to store the second byte if the
Karsten Hopp b70a64
   * first byte is 0x8e (single-width character).
Karsten Hopp b70a64
   *
Karsten Hopp b70a64
--- 25,35 ----
Karsten Hopp b70a64
   * one character which occupies two display cells.
Karsten Hopp b70a64
   * For UTF-8 a multi-byte character is converted to Unicode and stored in
Karsten Hopp b70a64
   * ScreenLinesUC[].  ScreenLines[] contains the first byte only.  For an ASCII
Karsten Hopp b70a64
!  * character without composing chars ScreenLinesUC[] will be 0 and
Karsten Hopp b70a64
!  * ScreenLinesC[][] is not used.  When the character occupies two display
Karsten Hopp b70a64
!  * cells the next byte in ScreenLines[] is 0.
Karsten Hopp b70a64
   * ScreenLinesC[][] contain up to 'maxcombine' composing characters
Karsten Hopp b70a64
!  * (drawn on top of the first character).  There is 0 after the last one used.
Karsten Hopp b70a64
   * ScreenLines2[] is only used for euc-jp to store the second byte if the
Karsten Hopp b70a64
   * first byte is 0x8e (single-width character).
Karsten Hopp b70a64
   *
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 4893,4898 ****
Karsten Hopp b70a64
--- 4894,4900 ----
Karsten Hopp b70a64
  
Karsten Hopp b70a64
  /*
Karsten Hopp b70a64
   * Return if the composing characters at "off_from" and "off_to" differ.
Karsten Hopp b70a64
+  * Only to be used when ScreenLinesUC[off_from] != 0.
Karsten Hopp b70a64
   */
Karsten Hopp b70a64
      static int
Karsten Hopp b70a64
  comp_char_differs(off_from, off_to)
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 6281,6286 ****
Karsten Hopp b70a64
--- 6283,6289 ----
Karsten Hopp b70a64
  /*
Karsten Hopp b70a64
   * Return TRUE if composing characters for screen posn "off" differs from
Karsten Hopp b70a64
   * composing characters in "u8cc".
Karsten Hopp b70a64
+  * Only to be used when ScreenLinesUC[off] != 0.
Karsten Hopp b70a64
   */
Karsten Hopp b70a64
      static int
Karsten Hopp b70a64
  screen_comp_differs(off, u8cc)
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 6461,6468 ****
Karsten Hopp b70a64
  		    && c == 0x8e
Karsten Hopp b70a64
  		    && ScreenLines2[off] != ptr[1])
Karsten Hopp b70a64
  		|| (enc_utf8
Karsten Hopp b70a64
! 		    && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
Karsten Hopp b70a64
! 			|| screen_comp_differs(off, u8cc)))
Karsten Hopp b70a64
  #endif
Karsten Hopp b70a64
  		|| ScreenAttrs[off] != attr
Karsten Hopp b70a64
  		|| exmode_active;
Karsten Hopp b70a64
--- 6464,6473 ----
Karsten Hopp b70a64
  		    && c == 0x8e
Karsten Hopp b70a64
  		    && ScreenLines2[off] != ptr[1])
Karsten Hopp b70a64
  		|| (enc_utf8
Karsten Hopp b70a64
! 		    && (ScreenLinesUC[off] !=
Karsten Hopp b70a64
! 				(u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
Karsten Hopp b70a64
! 			|| (ScreenLinesUC[off] != 0
Karsten Hopp b70a64
! 					  && screen_comp_differs(off, u8cc))))
Karsten Hopp b70a64
  #endif
Karsten Hopp b70a64
  		|| ScreenAttrs[off] != attr
Karsten Hopp b70a64
  		|| exmode_active;
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 7542,7548 ****
Karsten Hopp b70a64
  	new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
Karsten Hopp b70a64
  			     (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp b70a64
  	for (i = 0; i < p_mco; ++i)
Karsten Hopp b70a64
! 	    new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)(
Karsten Hopp b70a64
  			     (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp b70a64
      }
Karsten Hopp b70a64
      if (enc_dbcs == DBCS_JPNU)
Karsten Hopp b70a64
--- 7547,7553 ----
Karsten Hopp b70a64
  	new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
Karsten Hopp b70a64
  			     (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp b70a64
  	for (i = 0; i < p_mco; ++i)
Karsten Hopp b70a64
! 	    new_ScreenLinesC[i] = (u8char_T *)lalloc_clear((long_u)(
Karsten Hopp b70a64
  			     (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp b70a64
      }
Karsten Hopp b70a64
      if (enc_dbcs == DBCS_JPNU)
Karsten Hopp b70a64
*** ../vim-7.2.405/src/version.c	2010-03-23 14:39:07.000000000 +0100
Karsten Hopp b70a64
--- src/version.c	2010-03-23 15:34:11.000000000 +0100
Karsten Hopp b70a64
***************
Karsten Hopp b70a64
*** 683,684 ****
Karsten Hopp b70a64
--- 683,686 ----
Karsten Hopp b70a64
  {   /* Add new patch number below this line */
Karsten Hopp b70a64
+ /**/
Karsten Hopp b70a64
+     406,
Karsten Hopp b70a64
  /**/
Karsten Hopp b70a64
Karsten Hopp b70a64
-- 
Karsten Hopp b70a64
VOICE OVER: As the horrendous Black Beast lunged forward, escape for Arthur
Karsten Hopp b70a64
            and his knights seemed hopeless,  when, suddenly ... the animator
Karsten Hopp b70a64
            suffered a fatal heart attack.
Karsten Hopp b70a64
ANIMATOR:   Aaaaagh!
Karsten Hopp b70a64
VOICE OVER: The cartoon peril was no more ... The Quest for Holy Grail could
Karsten Hopp b70a64
            continue.
Karsten Hopp b70a64
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp b70a64
Karsten Hopp b70a64
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp b70a64
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp b70a64
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp b70a64
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///