Dominique Pellé <[email protected]> wrote:

> Bram Moolenaar <[email protected]> wrote:
>
>> Axel Bender wrote:
>>
>>> you may as well elimitate the inverted question mark (I just forgot to
>>> replace it in the example - in the base document there are no xs), the
>>> result is the same.
>>> Also, the effect is independent from enc (I tested it with both, utf8
>>> and latin1). In both cases fenc was empty.
>>
>> Well, something must be different, I still can't reproduct it.
>>
>> Can anybody else see the problem?
>
>
> I can reproduce it using Vim-7.2.1182 and the
> "spanish.txt" and "lang.vim" files posted in the
> first message of this thread.
>
> Here is an automated way to reproduce
> which should be easier:
>
> $ vim -f -g -U NONE -u NONE -i NONE --noplugin -N \
>   spanish.txt \
>   -c 'call feedkeys(":set re=1\<CR>:so lang.vim\<CR>GA abc\<Esc>k")'
>
> (notice that "abc" at the end of the last line has orange background)
>
> Now do the same but with re=2:
>
> $ vim -f -g -U NONE -u NONE -i NONE --noplugin -N \
>   spanish.txt \
>   -c 'call feedkeys(:set re=2\<CR>:so lang.vim\<CR>GA abc\<Esc>k")'
>
> (notice that "abc" has now a white background,
> which is different than before,  but press CTRL-L
> and notice that background of "abc" on last line
> becomes orange)
>
> Dominique


Valgrind finds a bug with this command (which uses re=2).
That can explain why it works for some and not for others:

$ valgrind vim -f -g -U NONE -u NONE -i NONE --noplugin -N \
    spanish.txt \
   -c 'call feedkeys(":set re=2\<CR>:so lang.vim\<CR>GA abc\<Esc>k")'

==10817== Invalid read of size 1
==10817==    at 0x4F333E: utf_ptr2char (mbyte.c:1697)
==10817==    by 0x54E02B: nfa_regmatch (regexp_nfa.c:5016)
==10817==    by 0x550A5C: nfa_regtry (regexp_nfa.c:6202)
==10817==    by 0x551140: nfa_regexec_both (regexp_nfa.c:6386)
==10817==    by 0x5515B9: nfa_regexec_multi (regexp_nfa.c:6635)
==10817==    by 0x5517A7: vim_regexec_multi (regexp.c:8073)
==10817==    by 0x59C351: syn_regexec (syntax.c:3272)
==10817==    by 0x599D44: syn_current_attr (syntax.c:2092)
==10817==    by 0x599529: get_syntax_attr (syntax.c:1851)
==10817==    by 0x559915: win_line (screen.c:4115)
==10817==    by 0x554949: win_update (screen.c:1866)
==10817==    by 0x551F75: update_screen (screen.c:536)
==10817==    by 0x5EDEEC: main_loop (main.c:1232)
==10817==    by 0x5EDA57: main (main.c:1020)
==10817==  Address 0xed2c4a1 is 1 bytes inside a block of size 69 free'd
==10817==    at 0x4C2A739: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10817==    by 0x4E761C: vim_free (misc2.c:1744)
==10817==    by 0x4C584B: ml_flush_line (memline.c:3481)
==10817==    by 0x4C350A: ml_get_buf (memline.c:2455)
==10817==    by 0x53C7F9: reg_getline (regexp.c:3696)
==10817==    by 0x54D657: recursive_regmatch (regexp_nfa.c:4551)
==10817==    by 0x54E3B2: nfa_regmatch (regexp_nfa.c:5197)
==10817==    by 0x550A5C: nfa_regtry (regexp_nfa.c:6202)
==10817==    by 0x551140: nfa_regexec_both (regexp_nfa.c:6386)
==10817==    by 0x5515B9: nfa_regexec_multi (regexp_nfa.c:6635)
==10817==    by 0x5517A7: vim_regexec_multi (regexp.c:8073)
==10817==    by 0x59C351: syn_regexec (syntax.c:3272)
==10817==    by 0x599D44: syn_current_attr (syntax.c:2092)
==10817==    by 0x599529: get_syntax_attr (syntax.c:1851)
==10817==    by 0x559915: win_line (screen.c:4115)
==10817==    by 0x554949: win_update (screen.c:1866)
==10817==    by 0x551F75: update_screen (screen.c:536)
==10817==    by 0x5EDEEC: main_loop (main.c:1232)
==10817==    by 0x5EDA57: main (main.c:1020)
(and more error after that)

reginput points to free memory.

I don't know how to fix it yet. Maybe reginput should be
saved before calling recursive_regmatch(...) at line
regexp_nfa.c:5197 and restored afterwards?

Dominique

-- 
-- 
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/groups/opt_out.


Raspunde prin e-mail lui