Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dpelle
Copy link
Member

@dpelle dpelle commented Feb 17, 2017

This PR fixes an invalid memory access in the :recover command in
Vim-8.0.336 and older. It's an old bug since at least vim-7.4.52
in ubuntu-14.04 already has the bug. Bug was found using afl-fuzz.

Step to reproduce:

$ valgrind vim -u NONE -c 'set dir=/' -c rec -cq 2>vg.log

And vg.log contains:

==17014== Memcheck, a memory error detector
==17014== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==17014== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==17014== Command: vim -u NONE -c set\ dir=/ -c rec -cq
==17014==
==17014== Invalid read of size 1
==17014== at 0x4AB231: recover_names (memline.c:1867)
==17014== by 0x4A9AD0: ml_recover (memline.c:1167)
==17014== by 0x46688B: ex_recover (ex_docmd.c:8234)
==17014== by 0x45CCFD: do_one_cmd (ex_docmd.c:2981)
==17014== by 0x458F5D: do_cmdline (ex_docmd.c:1120)
==17014== by 0x5D1F2C: exe_commands (main.c:2905)
==17014== by 0x5D1F2C: vim_main2 (main.c:781)
==17014== by 0x5D0859: main (main.c:415)
==17014== Address 0x769305f is 1 bytes before a block of size 2 alloc'd
==17014== at 0x4C2ABF5: malloc (vg_replace_malloc.c:299)
==17014== by 0x4C5A17: lalloc (misc2.c:942)
==17014== by 0x4AB150: recover_names (memline.c:1801)
==17014== by 0x4A9AD0: ml_recover (memline.c:1167)
==17014== by 0x46688B: ex_recover (ex_docmd.c:8234)
==17014== by 0x45CCFD: do_one_cmd (ex_docmd.c:2981)
==17014== by 0x458F5D: do_cmdline (ex_docmd.c:1120)
==17014== by 0x5D1F2C: exe_commands (main.c:2905)
==17014== by 0x5D1F2C: vim_main2 (main.c:781)
==17014== by 0x5D0859: main (main.c:415)

@brammool brammool closed this in c525e3a Feb 18, 2017
chrisbra pushed a commit to chrisbra/vim that referenced this pull request Mar 25, 2017
Problem:    Invalid memory access in :recover command.
Solution:   Avoid access before directory name. (Dominique Pelle,
            closes vim#1488)
desvp pushed a commit to desvp/vim that referenced this pull request May 30, 2017
Problem:    Invalid memory access in :recover command.
Solution:   Avoid access before directory name. (Dominique Pelle,
            closes vim#1488)
justinmk added a commit to justinmk/neovim that referenced this pull request Feb 3, 2018
Problem:    Invalid memory access in :recover command.
Solution:   Avoid access before directory name. (Dominique Pelle,
            closes vim/vim#1488)

vim/vim@c525e3a
justinmk added a commit to justinmk/neovim that referenced this pull request Feb 11, 2018
Problem:    Invalid memory access in :recover command.
Solution:   Avoid access before directory name. (Dominique Pelle,
            closes vim/vim#1488)

vim/vim@c525e3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant