George V. Reilly wrote:

> >> >> An autocmd, selectbuf#BufNew, is calling set cpo&vim. Vim is freeing
> >> >> invalid memory for the old value from did_set_string_option. The
> >> >> previous value was (probably) set by vim72a\menu.vim.
> >> >>
> >> >> I think get_varp_scope() is at fault.
> >> >
> >> > Hmm, could it be patch 7.2a.019?  No, that only changed something for
> >> > non-string options.
> >>
> >> You're freeing empty_option, as returned by get_varp(). Look at how
> >> many times 0x1`4035cffa recurs below.
> >
> > It's perfectly normal for many options to point to empty_option.
> >
> >> Callstack from WinDbg:
> >> 0:000> kp
> >> Child-SP          RetAddr           Call Site
> >> 00000000`0012ece0 00000001`40153e79 gvimd!free_string_option(unsigned
> >> char * p = 0x00000001`4035cffa "")+0x1d [z:\vimsrc\vim7.2\src\option.c
> >
> > The free_string_option() function explicitly checks for empty_option.
> > So where is it that an option value is freed without checking for
> > empty_option?  Or is there a problem with 64-bit in here somewhere?
> 
> Yes, you're right.
> 
> I believe I have it this time. ex_helpgrep is setting p_cpo =
> (char_u*)"", then that's being free'd as a side-effect of an autocmd
> doing "set cpo&vim".

Good catch.  String options should never be set to a static string,
unless we are 100% sure nobody can set the option.

I'll change it, also taking care of not restoring the value if it was
changed in the mean time.

I found a couple of other places with a similar problem.  Unlikely to
happen, but you never know when someone does weird things.

-- 
hundred-and-one symptoms of being an internet addict:
232. You start conversations with, "Have you gotten an ISDN line?"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

Raspunde prin e-mail lui