Steps to reproduce:
- start Vim with the following command:
$ vim -u NONE -U NONE -c 'set fo=or com=s\:/*,mb\:***,ex\:*/'
- enter insert mode and insert the following:
/*
- open a new line below either by pressing Enter in insert mode or by
pressing "o" in normal mode.
Vim will crash.
If you fail to reproduce the crash, change the number of spaces before
the opening comment (the more spaces, the further beyond the allocated
buffer writing will occur). Note that it is essential that the middle
comment leader be longer than the opening one.
The attached patch fixes the problem.
--
Cheers,
Lech
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
diff --git a/src/misc1.c b/src/misc1.c
index f7da7c4..aa90215 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1121,7 +1121,7 @@ open_line(dir, flags, old_indent)
if (i != lead_repl_len)
{
mch_memmove(p + lead_repl_len, p + i,
- (size_t)(lead_len - i - (leader - p)));
+ (size_t)(lead_len - i - (p - leader)));
lead_len += lead_repl_len - i;
}
}