Yegappan Lakshmanan wrote:

> Hi,
>
> The following commands crash Vim when run with ASAN:
>
>    $ vim -N --clean
>    :e abc
>    :let b=getbufinfo()
>    :%bwipe
>    :call test_garbage_collect()
>
> It looks like some buffer local variables are freed by the bwipe command
> even though they are still referenced by the variable 'b'.
>
> - Yegappan


The function is test_garbagecollect_now(), not test_garbage_collect().

Bug is reproducible with valgrind:

$ valgrind vim --clean -c'let b=getbufinfo()|%bw|call
test_garbagecollect_now()|q' abc 2>vg.log

And vg.log contains:

==3768== Memcheck, a memory error detector
==3768== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3768== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==3768== Command: vim --clean -clet\ b=getbufinfo()|%bw|call\
test_garbagecollect_now()|q abc
==3768==
==3768== Invalid read of size 4
==3768==    at 0x437976: set_ref_in_item (eval.c:5501)
==3768==    by 0x437DC4: set_ref_in_ht (eval.c:5429)
==3768==    by 0x438002: garbage_collect (eval.c:5278)
==3768==    by 0x455EB1: call_internal_func (evalfunc.c:1012)
==3768==    by 0x5A5010: call_func (userfunc.c:1446)
==3768==    by 0x5A6171: get_func_tv (userfunc.c:455)
==3768==    by 0x5A8C59: ex_call (userfunc.c:3082)
==3768==    by 0x476E63: do_one_cmd (ex_docmd.c:2908)
==3768==    by 0x476E63: do_cmdline (ex_docmd.c:1071)
==3768==    by 0x5F2E70: exe_commands (main.c:2954)
==3768==    by 0x5F2E70: vim_main2 (main.c:799)
==3768==    by 0x413BFC: main (main.c:415)
==3768==  Address 0x10db2b00 is 208 bytes inside a block of size 7,224 free'd
==3768==    at 0x4C2ECF0: free (vg_replace_malloc.c:530)
==3768==    by 0x41DAE9: empty_curbuf (buffer.c:1264)
==3768==    by 0x41E871: do_bufdel (buffer.c:1179)
==3768==    by 0x46E17F: ex_bunload (ex_docmd.c:5558)
==3768==    by 0x476E63: do_one_cmd (ex_docmd.c:2908)
==3768==    by 0x476E63: do_cmdline (ex_docmd.c:1071)
==3768==    by 0x5F2E70: exe_commands (main.c:2954)
==3768==    by 0x5F2E70: vim_main2 (main.c:799)
==3768==    by 0x413BFC: main (main.c:415)
==3768==  Block was alloc'd at
==3768==    at 0x4C2DBF6: malloc (vg_replace_malloc.c:299)
==3768==    by 0x4D4330: lalloc (misc2.c:954)
==3768==    by 0x4D4C64: alloc_clear (misc2.c:876)
==3768==    by 0x41EE43: buflist_new (buffer.c:1999)
==3768==    by 0x5ABC72: win_alloc_firstwin (window.c:3488)
==3768==    by 0x5ABCDA: win_alloc_first (window.c:3444)
==3768==    by 0x5F171A: common_init (main.c:1010)
==3768==    by 0x41364B: main (main.c:173)

Regards
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/d/optout.

Raspunde prin e-mail lui