Dominique wrote:

> Bram Moolenaar wrote:
> 
> > Patch 7.4.025 (after 7.4.019
> > Problem:    Reading before start of a string.
> > Solution:   Do not call mb_ptr_back() at start of a string. (Dominique 
> > Pelle)
> > Files:      src/edit.c
> 
> Hi
> 
> I can still see an error with valgrind when using vim-7.4.26 :-(
> 
> ==12820== Invalid read of size 1
> ==12820==    at 0x4BCED6: utf_head_off (mbyte.c:3434)
> ==12820==    by 0x42430C: ins_complete (edit.c:5189)
> ==12820==    by 0x42A801: edit (edit.c:1410)
> ==12820==    by 0x4C1137: invoke_edit (normal.c:9232)
> ==12820==    by 0x4C3761: nv_edit (normal.c:9205)
> ==12820==    by 0x4C9054: normal_cmd (normal.c:1200)
> ==12820==    by 0x576B39: main_loop (main.c:1329)
> ==12820==    by 0x579C6B: main (main.c:1020)
> ==12820==  Address 0xc45cecf is 1 bytes before a block of size 2 alloc'd
> ==12820==    at 0x4C2B3F8: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==12820==    by 0x4B5E26: lalloc (misc2.c:929)
> ==12820==    by 0x4B5ECB: alloc_check (misc2.c:862)
> ==12820==    by 0x4A9A46: ins_char_bytes (misc1.c:2256)
> ==12820==    by 0x4A9C16: ins_bytes_len (misc1.c:2107)
> ==12820==    by 0x4A9C6B: ins_bytes (misc1.c:2080)
> ==12820==    by 0x41DE81: ins_compl_insert (edit.c:4589)
> ==12820==    by 0x423992: ins_compl_next (edit.c:4761)
> ==12820==    by 0x42499B: ins_complete (edit.c:5394)
> ==12820==    by 0x42A801: edit (edit.c:1410)
> ==12820==    by 0x4C1137: invoke_edit (normal.c:9232)
> ==12820==    by 0x4C3761: nv_edit (normal.c:9205)
> 
> Here is How to reproduce:
> 
> $ mkdir /tmp/test
> $ cd /tmp/test
> $ touch a b
> $ valgrind --log-file=valgrind.log vim -u NONE -N \
>    -c ':call feedkeys("i\<C-X>\<C-F>\<BS>\<C-X>\<C-F>")'
> 
> ... and observe errors in /tmp/valgrind.log.
> I don't have time to debug now but I will look at it later.

I suppose this is because of the head_off before the lines we changed.
Test 32 doesn't run into this.

OK, with an addition to test 32 I can reproduce the valgrind error.

Yes, it's indeed the first mb_head_off() call.  Also needs an "if".

-- 
I'm in shape.  Round IS a shape.

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

Raspunde prin e-mail lui