Dominique Pelle wrote:

> Valgrind memory checker detects the following bug in Vim-7.1.285:
> 
> ==10530== Conditional jump or move depends on uninitialised value(s)
> ==10530==    at 0x81665C7: win_line (screen.c:2955)
> ==10530==    by 0x8164049: win_update (screen.c:1765)
> ==10530==    by 0x81621A8: update_screen (screen.c:522)
> ==10530==    by 0x80E5FAC: main_loop (main.c:1110)
> ==10530==    by 0x80E5C45: main (main.c:940)
> 
> (more errors follow after this first error)
> 
> Bug happens with spelling checker on (:set spell) and when editing
> a file with which has >= 150 spaces of indentation (SPWORLDLEN = 150).
> 
> Bug happens because STRLEN(nextline + SPWORDLEN) is called with
> string 'nextline + SPWORDLEN' (at screen.c:2956) which is then not
> NUL terminated.  String is initialized by spell_cat_line(...) at
> line screen.c:2748.  When line has >= 150 leading spaces, the
> output of spell_cat_line() is a string with 150 spaces and
> _without_ end of string, hence the bug when later using
> STRLEN(...) on that string.
> 
> I attach 2 patches. Both of them fix it:
> 
> - first patch just fixes the bug with minimal number of changes
>   to minimize the risks.
> 
> - second patch also fixes it but also improves spell_cat_line()
>   slightly:
> 
>     o it avoids writing characters twice (simpler and faster).
> 
>     o it avoids concatenating anything when next line has >= 150
>       spaces (it seems a waste of time to concatenate just
>       spaces in that case).

I like the second patch.  Thanks!

-- 
If Microsoft would build a car...
... The airbag system would ask "are you SURE?" before deploying.

 /// 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