Dominique wrote:

> The attached bug.vim script causes a crash in Vim-7.4.2343:
> 
> $ vim -u NONE -N -S bug.vim
> Vim: Caught deadly signal SEGV
> Segmentation fault (core dumped)
> 
> The crash was introduced by recent patch Vim-7.4.2326:
> 
> ===
> commit d5824ce1b5491df7d2eb0b66189d366fa67b4585
> Author: Bram Moolenaar <[email protected]>
> Date:   Sun Sep 4 20:35:01 2016 +0200
> 
>     patch 7.4.2326
>     Problem:    Illegal memory access when Visual selection starts in invalid
>                 position. (Dominique Pelle)
>     Solution:   Correct position when needed.
> ===
> 
> However, prior to this patch, it was barely better anyway
> because vim-7.4.2325 and older were giving ml_get internal
> errors on that same bug.vim script:
> 
> $ vim -u NONE -N -S bug.vim
> Error detected while processing /tmp/vim/src/c.vim:
> line    6:
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> E315: ml_get: invalid lnum: 2
> Press ENTER or type command to continue

I cannot reproduce the problem.  I also see nothing in valgrid.

I assume the line "normal <11>" should be "normal <16>", where <16> is
CTRL-V.  This starts Visual block mode.  CTRL-Q does not work here.

But then the "bw!" command does not appear to work.  The trailing CTRL-V
consumes it.  Hmm, it gets closer when I use:

        new
        call setline(1,range(1,2))
        2
        exe "norm \<C-V>"
        bw!
        norm yp

But still no error.  In a debugger I can see it never yanks, because the
region is empty.  OK, let's add some text before splitting:

        call setline(1,'xxx')
        normal $
        new
        call setline(1,range(1,2))
        2
        exe "norm \<C-V>$"
        bw!
        norm yp

That triggers the crash.

I think we should check the operator end position before the first time
line_count is computed, thus much earlier than where it was before.
And also when use_mbyte is false.

But really, leaving Visual mode active when closing the buffer is not
good.  Let's just stop it.


-- 
hundred-and-one symptoms of being an internet addict:
204. You're being audited because you mailed your tax return to the IRC.

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