Yegappan Lakshmanan wrote:

> On Thu, Apr 21, 2016 at 8:34 AM, Manuel Ortega <[email protected]> wrote:
> > On Thu, Apr 21, 2016 at 2:57 AM, Bram Moolenaar <[email protected]> wrote:
> >>
> >> Manuel Ortega wrote:
> >>
> >> > On OS X 10.11.4, Vim 7.4.1759 after a fresh clone of the git repo, I get
> >> > this:
> >> >
> >> > >From test_alot.vim:
> >> > Found errors in Test_strcharpart():
> >> > function RunTheTest[9]..Test_strcharpart line 8: Expected '' but got 'a'
> >> > function RunTheTest[9]..Test_strcharpart line 9: Expected '' but got 'a'
> >> > function RunTheTest[9]..Test_strcharpart line 11: Expected 'a' but got
> >> > 'ax'
> >> > TEST FAILURE
> >>
> >> That is very strange.  The test passes on most systems.
> >>
> >> To reduce the number of possibilities: is this Vim build with multi-byte
> >> suport?
> >>
> >> You can try executing the lines in src/testdir/test_expr.vim manually
> >> and see if you can guess what might be wrong.  It must have something to
> >> do with the negative start index.
> >
> >
> > I tried again and suddenly the test passes.  I swear on all that is holy
> > that when I encounter test failures I try at least three times to reproduce
> > them, with a `git clean -fdx` in between.  Perhaps I did something silly,
> > though I don't know what that could be.  Either that, or this is a genuinely
> > intermittently-failing test.
> >
> > I'll keep trying to see if I can get it to fail again.  BTW, yes, it's with
> > multibyte support.
> >
> 
> I can reproduce this issue. I built Vim with the clang sanitizer and found
> that there is a heap overflow in the f_strcharpart() function in eval.c
> in the following line:
> 
>            len += mb_char2len(p[nbyte + len]);
> 
> When executing this line, nbyte is -1, len is 0 which results in an invalid
> access.
> 
> I can reproduce this problem, by running the following command:
> 
>      echo strcharpart('axb', -1, 1)

Thanks.  Running the test under valgrind also shows the problem.

-- 
ARTHUR:        A scratch?  Your arm's off!
BLACK KNIGHT:  No, it isn't.
ARTHUR:        Well, what's that then?
BLACK KNIGHT:  I've had worse.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui