Dominique Pelle wrote:

> On 8/22/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> 
> > Perhaps you can add a "max_off" variable, set to LineOffset[row] +
> > screen_Columns.  Then avoid calling mb_off2cells(off) when  off is
> > max_off - 2 or more.
> 
> With your indications, I modified my original patch.  My previous
> patch actually did not fix all accesses to uninitialized memory.
> More errors were reported when writing characters that occupy two
> cells at the bottom right of the screen.  An easy way to reproduce
> it was to type ":" to enter Ex mode, and then type some text till the
> final cell of the screen.  Valgrind then reported errors.  I tried
> with single cell characters (ASCII characters for example) as well
> as double cell characters (Chinese characters for example).
> 
> Since the boolean expressions was already quite complicated, I did
> not feel like making it even more complicated by adding some (off
> < max_off - 1) as well as (off < max_off - 2). So I broke the
> boolean expression into a couple of 'if'.  I find it easier to
> read it that way.  I hope that's OK.
> 
> I attach my new patch.  Many things in screen.c are still
> mysterious to me, so definitely review it to make sure it does not
> break anything.
> 
> Attached: patch-uninit-mem-access-utf_off2cells-2.txt

Thanks for looking into the details.  I'll check that this is the best
way to do this.  There might be other mb_off2cells() calls that have the
same problem, perhaps passing the maximum and checking it inside the
function avoids all of them at one go, at the cost of passing an extra
argument.

-- 
You can tune a file system, but you can't tuna fish
                                                        -- man tunefs

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