Hi Bram and Vim developers,
How to reproduce:
- start Vim and set 'hi' option to huge value.
$ vim -N -u NONE -c "set history=100000000"
- Input colon.
:
Occurred pattern #1
- OS get stuck (Verrry slow response)
Occurred pattern #2
- get 'E342'
E342: Out of memory! (allocating 1600000000 bytes)
- And Vim can not terminated by ':q'.
(I know terminated ZQ or ZZ)
Investigation for #1
- `:` typed after 'hi'option changed, call init_history().
This function is call lalloc() by huge value.
(p_hi * 16 = 1600000000)
I think we should have an upper limit to 'hi'. (10000 in Patch#1)
Investigation for #2
- If an error occurs after I press the colon, The command line
is not interpreted in the usual way.
[ea.skip ... ex_docmd.c:1972]
So, if get an error in init_history() and command-line
character is `:`, Then I clear the did_emsg.
I attached two patches.
Please check these.
Thank you for reading my crazy English :-)
--
Best regards,
Hirohito Higashi
--
--
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.
diff -r 4aa63564dd3f runtime/doc/options.txt
--- a/runtime/doc/options.txt Wed Jun 18 21:38:18 2014 +0200
+++ b/runtime/doc/options.txt Tue Jun 24 23:09:29 2014 +0900
@@ -3926,6 +3926,7 @@
A history of ":" commands, and a history of previous search patterns
are remembered. This option decides how many entries may be stored in
each of these histories (see |cmdline-editing|).
+ The maximum value is 10000.
NOTE: This option is set to the Vi default value when 'compatible' is
set and to the Vim default value when 'compatible' is reset.
diff -r 4aa63564dd3f src/option.c
--- a/src/option.c Wed Jun 18 21:38:18 2014 +0200
+++ b/src/option.c Tue Jun 24 23:09:29 2014 +0900
@@ -8595,6 +8595,11 @@
errmsg = e_positive;
p_hi = 0;
}
+ else if (p_hi > 10000)
+ {
+ errmsg = e_invarg;
+ p_hi = 10000;
+ }
if (p_re < 0 || p_re > 2)
{
errmsg = e_invarg;
diff -r 4aa63564dd3f src/ex_getln.c
--- a/src/ex_getln.c Wed Jun 18 21:38:18 2014 +0200
+++ b/src/ex_getln.c Tue Jun 24 23:34:30 2014 +0900
@@ -205,6 +205,9 @@
* custom status line may invoke ":normal". */
struct cmdline_info save_ccline;
#endif
+#ifdef FEAT_CMDHIST
+ int did_emsg_orig;
+#endif
#ifdef FEAT_SNIFF
want_sniff_request = 0;
@@ -333,7 +336,11 @@
settmode(TMODE_RAW);
#ifdef FEAT_CMDHIST
+ did_emsg_orig = did_emsg;
init_history();
+ if (did_emsg && !did_emsg_orig && firstc == ':')
+ did_emsg = 0; /* When error occured in init_history(),
+ But We can execute ':q'. */
hiscnt = hislen; /* set hiscnt to impossible history value */
histype = hist_char2type(firstc);
#endif