Yukihiro Nakadaira wrote:

> Dominique Pellé wrote:
> > Hi
> > 
> > I see the following Valgrind error with Gvim-7.2.402 (GTK2 GUI on Linux).
> > 
> > ==12686== Conditional jump or move depends on uninitialised value(s)
> > ==12686==    at 0x53A5E0: screen_comp_differs (screen.c:6294)
> > ==12686==    by 0x53AB30: screen_puts_len (screen.c:6456)
> > ==12686==    by 0x53A177: win_redr_custom (screen.c:6179)
> > ==12686==    by 0x539B88: redraw_custom_statusline (screen.c:5948)
> > ==12686==    by 0x53969F: win_redr_status (screen.c:5810)
> > ==12686==    by 0x52EEC3: update_screen (screen.c:532)
> > ==12686==    by 0x4AA976: main_loop (main.c:1128)
> > ==12686==    by 0x4AA610: main (main.c:955)
> > (and more errors after that)
[...]
> > 
> > The patch which introduces the bug is:
> > 
> >  Patch 7.2.119
> >  Problem:    Status line is redrawn too often.
> >  Solution:   Check ScreeenLinesUC[] properly. (Yukihiro Nakadaira)
> >  Files:      src/screen.c
> > 
> > Patch seemed to be only an optimization. But since it breaks
> > something, we should revert it back I think, unless someone
> > knows how to fix it?  I verified that no error happens when
> > reverting it (as in attached patch).
> 
> It seems that ScreenLinesC is not cleared when allocating screen buffer
> with screenalloc(TRUE) and it is not assigned any value for an ASCII
> character.  Maybe ScreenLinesC is not expected to be an valid value when
> ScreenLinesUC == 0?
> 
> And also the current code does not work for when "c" is ASCII character
> and "u8cc" contains composing character.
> 
> I can't reproduce valgrind error surely.  But I think the following
> patch will fix the bug.
> 
> --- a/src/screen.c
> +++ b/src/screen.c
> @@ -6461,8 +6461,8 @@
>                   && c == 0x8e
>                   && ScreenLines2[off] != ptr[1])
>               || (enc_utf8
> -                 && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
> -                     || screen_comp_differs(off, u8cc)))
> +                 && (ScreenLinesUC[off] != (u8char_T)(c < 0x80 && u8cc[0] == 
> 0 ? 0 : u8c)
> +                     || (ScreenLinesUC[off] != 0 && screen_comp_differs(off, 
> u8cc))))
>   #endif
>               || ScreenAttrs[off] != attr
>               || exmode_active;

Yes, that should fix the problem.

Additionally, I think that new_ScreenLinesC[i] needs to be cleared when
allocated.  The contents is only to be used when ScreenLinesUC[off] is
non-zero, but when reallocating the screen the contents may be copied
without checking ScreenLinesUC[off].

-- 
I bought a book on hair loss, but the pages kept falling out.

 /// 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.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe from this group, send email to 
vim_dev+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Raspunde prin e-mail lui