Re: gvim crash when using UTF-8 locale and paste text from Windows clipboard

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: gvim crash when using UTF-8 locale and paste text from Windows clipboard

Bram Moolenaar

Rainux wrote:

> I'm sorry for some personal reason I've left some days.
>
> >                 {
> >                         char *ts =3D _("%ld more lines");
> >                         sprintf((char *)msg_buf, ts, pn);
> >                 }
> >
> > If it now crashes in sprintf() then it's a different problem.  But from
> > your description it should crash in _().
>
> I did this, and it crash in sprintf(), seems the problem is in msvcrt.dll.
>
> I use Borland C++ 5.5.1 for Win32 compile Vim just now(previously I
> use Cygwin's gcc), and found the new gvim.exe's import table don't
> have msvcrt.dll. And, this build of gvim never crashes in zh_CN.UTF-8.
> So I think the problem should in msvcrt.dll(Bram use MSVC compile Vim,
> so the "official build" rely on msvcrt.dll).

The problem may be that there is a % character in the second byte of one
of the Chinese double-byte characters.  sprintf() then may see the wrong
arguments.

Another possibility is that msg_buf is too small.  I made it longer a
short while ago.  Currently it's 480 bytes.  In Vim 6.3 the value was
80.  Patch 6.3.072 changed it to 240.  If you are still using 80 then
this is probably the cause of the trouble.

--
"Hegel was right when he said that we learn from history that man can
never learn anything from history."       (George Bernard Shaw)

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///