Here are the steps:
1. Get Visual Studio 2012. The Express edition should be using the
same compiler for the backend but I'm not sure.
2. Compile VIM. Not that the default Make_mvc.mak file doesn't work
anymore because the Windows SDK is no longer referenced by the
vcvarsall.bat. Instead I had to follow the instructions here:
http://kalekold.net/index.php?post=23 . Changes are noted in
Make_mvc.vc11.diff (/Ox -> /Od for debug purposes). I am using the
following batch file to simplify the compile process (_msvc.bat.diff).
3. Install UltiSnips
(http://www.vim.org/scripts/script.php?script_id=2715)
4. Use one of the snippets and it should crash (like the snippet
"once<TAB>").

Of course, the bug is there regardless of the compiler. VS2012 must do
bounds checking or something which is giving a more helpful error than
other compilers which probably just let Vim give unspecified behaviour
when this happens, i.e. there will just be memory corruption.

Reading your analysis, I realized that I had mentally parsed '&&' in
the for loop as '||' for some reason, and your reasoning should be
correct. I guess I was confused as to why a function that is designed
to escape a multi-byte character (from the description in the
comments) would be passed a potentially multi-byte string.

It is undoing Vim's internal 'keypress escaping' which prevents
multibyte characters from being mistaken for special keys (arrow keys,
and mouse events which Vim represents internally as keypresses, etc.).
It is not undoing some kind of multi-byte-to-single-byte representation.

Changing it to +2 does prevent a crash, although like you said you
don't know what effect it would have.

That fix will work, but it does one more unnecessary iteration of the
loop than my fix (so I guess it's about 4% slower; but since the
function is probably about 270% slower than it naively needs to be, and
probably something like eight times slower than it really needs to be if
the logic were completely rewritten, I guess that's pretty
insignificant!).

Smiles,

Ben.



--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui