Karsten Hopp d4d234
To: vim_dev@googlegroups.com
Karsten Hopp d4d234
Subject: Patch 7.4.695
Karsten Hopp d4d234
Fcc: outbox
Karsten Hopp d4d234
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d4d234
Mime-Version: 1.0
Karsten Hopp d4d234
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d4d234
Content-Transfer-Encoding: 8bit
Karsten Hopp d4d234
------------
Karsten Hopp d4d234
Karsten Hopp d4d234
Patch 7.4.695
Karsten Hopp d4d234
Problem:    Out-of-bounds read, dectected by Coverity.
Karsten Hopp d4d234
Solution:   Remember the value of cmap for the first matching encoding.  Reset
Karsten Hopp d4d234
            cmap to that value if first matching encoding is going to be used.
Karsten Hopp d4d234
            (Eliseo Martínez)
Karsten Hopp d4d234
Files:      src/hardcopy.c
Karsten Hopp d4d234
Karsten Hopp d4d234
Karsten Hopp d4d234
*** ../vim-7.4.694/src/hardcopy.c	2015-03-31 13:33:00.797524914 +0200
Karsten Hopp d4d234
--- src/hardcopy.c	2015-04-13 14:38:35.893079993 +0200
Karsten Hopp d4d234
***************
Karsten Hopp d4d234
*** 2513,2525 ****
Karsten Hopp d4d234
--- 2513,2530 ----
Karsten Hopp d4d234
      props = enc_canon_props(p_encoding);
Karsten Hopp d4d234
      if (!(props & ENC_8BIT) && ((*p_pmcs != NUL) || !(props & ENC_UNICODE)))
Karsten Hopp d4d234
      {
Karsten Hopp d4d234
+ 	int cmap_first;
Karsten Hopp d4d234
+ 
Karsten Hopp d4d234
  	p_mbenc_first = NULL;
Karsten Hopp d4d234
  	for (cmap = 0; cmap < (int)NUM_ELEMENTS(prt_ps_mbfonts); cmap++)
Karsten Hopp d4d234
  	    if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap],
Karsten Hopp d4d234
  								    &p_mbenc))
Karsten Hopp d4d234
  	    {
Karsten Hopp d4d234
  		if (p_mbenc_first == NULL)
Karsten Hopp d4d234
+ 		{
Karsten Hopp d4d234
  		    p_mbenc_first = p_mbenc;
Karsten Hopp d4d234
+ 		    cmap_first = cmap;
Karsten Hopp d4d234
+ 		}
Karsten Hopp d4d234
  		if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap],
Karsten Hopp d4d234
  								   &p_mbchar))
Karsten Hopp d4d234
  		    break;
Karsten Hopp d4d234
***************
Karsten Hopp d4d234
*** 2527,2533 ****
Karsten Hopp d4d234
--- 2532,2541 ----
Karsten Hopp d4d234
  
Karsten Hopp d4d234
  	/* Use first encoding matched if no charset matched */
Karsten Hopp d4d234
  	if (p_mbchar == NULL && p_mbenc_first != NULL)
Karsten Hopp d4d234
+ 	{
Karsten Hopp d4d234
  	    p_mbenc = p_mbenc_first;
Karsten Hopp d4d234
+ 	    cmap = cmap_first;
Karsten Hopp d4d234
+ 	}
Karsten Hopp d4d234
      }
Karsten Hopp d4d234
  
Karsten Hopp d4d234
      prt_out_mbyte = (p_mbenc != NULL);
Karsten Hopp d4d234
*** ../vim-7.4.694/src/version.c	2015-04-13 12:57:49.638724360 +0200
Karsten Hopp d4d234
--- src/version.c	2015-04-13 14:40:35.539753218 +0200
Karsten Hopp d4d234
***************
Karsten Hopp d4d234
*** 743,744 ****
Karsten Hopp d4d234
--- 743,746 ----
Karsten Hopp d4d234
  {   /* Add new patch number below this line */
Karsten Hopp d4d234
+ /**/
Karsten Hopp d4d234
+     695,
Karsten Hopp d4d234
  /**/
Karsten Hopp d4d234
Karsten Hopp d4d234
-- 
Karsten Hopp d4d234
People who want to share their religious views with you
Karsten Hopp d4d234
almost never want you to share yours with them.
Karsten Hopp d4d234
Karsten Hopp d4d234
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d4d234
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d4d234
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d4d234
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///