[patch] fixed access to uninitialized mem when using :wundo in unnamed buffer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] fixed access to uninitialized mem when using :wundo in unnamed buffer

Dominique Pellé
Hi

I see Valgrind errors in Vim-7.3a BETA (f8222d1f9a73) when using the
wundo command in an unnamed buffer:

$ valgrind --track-origins=yes vim -u NONE  -c 'wundo! foo' 2> vg.log

==4800== Syscall param stat64(file_name) points to unaddressable byte(s)
==4800==    at 0x499BC83: __xstat64@@GLIBC_2.2 (xstat64.c:50)
==4800==    by 0x81E4BDB: stat64 (in /home/pel/sb/vim/src/vim)
==4800==    by 0x81BBF38: u_write_undo (undo.c:1243)
==4800==    by 0x80AF8B8: ex_wundo (ex_docmd.c:8471)
==4800==    by 0x80A6DE4: do_one_cmd (ex_docmd.c:2639)
==4800==    by 0x80A46BD: do_cmdline (ex_docmd.c:1108)
==4800==    by 0x80A3D77: do_cmdline_cmd (ex_docmd.c:714)
==4800==    by 0x80E8FA8: exe_commands (main.c:2750)
==4800==    by 0x80E6785: main (main.c:880)
==4800==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4800==
==4800== Conditional jump or move depends on uninitialised value(s)
==4800==    at 0x81BC0EE: u_write_undo (undo.c:1305)
==4800==    by 0x80AF8B8: ex_wundo (ex_docmd.c:8471)
==4800==    by 0x80A6DE4: do_one_cmd (ex_docmd.c:2639)
==4800==    by 0x80A46BD: do_cmdline (ex_docmd.c:1108)
==4800==    by 0x80A3D77: do_cmdline_cmd (ex_docmd.c:714)
==4800==    by 0x80E8FA8: exe_commands (main.c:2750)
==4800==    by 0x80E6785: main (main.c:880)
==4800==  Uninitialised value was created by a stack allocation
==4800==    at 0x81BBEDA: u_write_undo (undo.c:1219)
(more errors after that)

Attached patch fixes it.

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

fixed-wundo-undo.c-7.3a.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] fixed access to uninitialized mem when using :wundo in unnamed buffer

Bram Moolenaar

Dominique Pelle wrote:

> I see Valgrind errors in Vim-7.3a BETA (f8222d1f9a73) when using the
> wundo command in an unnamed buffer:
>
> $ valgrind --track-origins=yes vim -u NONE  -c 'wundo! foo' 2> vg.log
>
> ==4800== Syscall param stat64(file_name) points to unaddressable byte(s)
> ==4800==    at 0x499BC83: __xstat64@@GLIBC_2.2 (xstat64.c:50)
> ==4800==    by 0x81E4BDB: stat64 (in /home/pel/sb/vim/src/vim)
> ==4800==    by 0x81BBF38: u_write_undo (undo.c:1243)
> ==4800==    by 0x80AF8B8: ex_wundo (ex_docmd.c:8471)
> ==4800==    by 0x80A6DE4: do_one_cmd (ex_docmd.c:2639)
> ==4800==    by 0x80A46BD: do_cmdline (ex_docmd.c:1108)
> ==4800==    by 0x80A3D77: do_cmdline_cmd (ex_docmd.c:714)
> ==4800==    by 0x80E8FA8: exe_commands (main.c:2750)
> ==4800==    by 0x80E6785: main (main.c:880)
> ==4800==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
> ==4800==
> ==4800== Conditional jump or move depends on uninitialised value(s)
> ==4800==    at 0x81BC0EE: u_write_undo (undo.c:1305)
> ==4800==    by 0x80AF8B8: ex_wundo (ex_docmd.c:8471)
> ==4800==    by 0x80A6DE4: do_one_cmd (ex_docmd.c:2639)
> ==4800==    by 0x80A46BD: do_cmdline (ex_docmd.c:1108)
> ==4800==    by 0x80A3D77: do_cmdline_cmd (ex_docmd.c:714)
> ==4800==    by 0x80E8FA8: exe_commands (main.c:2750)
> ==4800==    by 0x80E6785: main (main.c:880)
> ==4800==  Uninitialised value was created by a stack allocation
> ==4800==    at 0x81BBEDA: u_write_undo (undo.c:1219)
> (more errors after that)
>
> Attached patch fixes it.

Thanks, I'll include it.

I reversed the logic for setting the group bits, when perm is 0600 it
doesn't change anything.

--
From "know your smileys":
 :-F Bucktoothed vampire with one tooth missing

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.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