Hi

While using Vim-7.2.30 built with GUI GTK (huge), I stumbled
upon this error with Valgrind memory checker:

==13326== Source and destination overlap in memcpy(0x4B5D8D8, 0x4B5D8E4, 13)
==13326==    at 0x4024C92: memcpy (mc_replace_strmem.c:402)
==13326==    by 0x8102E99: LookupName (if_xcmdsrv.c:1021)
==13326==    by 0x810197E: DoRegisterName (if_xcmdsrv.c:303)
==13326==    by 0x8101718: serverRegisterName (if_xcmdsrv.c:225)
==13326==    by 0x81076D1: prepare_server (main.c:3379)
==13326==    by 0x8104253: main (main.c:721)

Attached patch fixes it by calling mch_memmove() instead of memcpy().
Looking at the code, I found another place where the same problem would
also happen (also fixed in patch).

Cheers
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: if_xcmdsrv.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/if_xcmdsrv.c,v
retrieving revision 1.11
diff -c -r1.11 if_xcmdsrv.c
*** if_xcmdsrv.c	6 Aug 2008 16:38:13 -0000	1.11
--- if_xcmdsrv.c	7 Nov 2008 19:47:32 -0000
***************
*** 1018,1024 ****
  	p++;
  	count = numItems - (p - regProp);
  	if (count > 0)
! 	    memcpy(entry, p, count);
  	XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
  			8, PropModeReplace, regProp,
  			(int)(numItems - (p - entry)));
--- 1018,1024 ----
  	p++;
  	count = numItems - (p - regProp);
  	if (count > 0)
! 	    mch_memmove(entry, p, count);
  	XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
  			8, PropModeReplace, regProp,
  			(int)(numItems - (p - entry)));
***************
*** 1072,1078 ****
  		p++;
  		lastHalf = numItems - (p - regProp);
  		if (lastHalf > 0)
! 		    memcpy(entry, p, lastHalf);
  		numItems = (entry - regProp) + lastHalf;
  		p = entry;
  		continue;
--- 1072,1078 ----
  		p++;
  		lastHalf = numItems - (p - regProp);
  		if (lastHalf > 0)
! 		    mch_memmove(entry, p, lastHalf);
  		numItems = (entry - regProp) + lastHalf;
  		p = entry;
  		continue;

Raspunde prin e-mail lui