While working on djm's wishlist I ran across a hang.
To reproduce the hang go like: "^[16000l" which would insert 16000
letter l'. As far as I know going over the line limit makes no sense so
limit it's repetition and prevent the hang in the process.
ok?
Index: emacs.c
===================================================================
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 emacs.c
--- emacs.c 14 Mar 2011 21:20:01 -0000 1.43
+++ emacs.c 4 Sep 2011 20:40:25 -0000
@@ -1787,8 +1787,13 @@ x_set_arg(int c)
int first = 1;
c &= CHARMASK; /* strip command prefix */
- for (; c >= 0 && isdigit(c); c = x_e_getc(), first = 0)
+ for (; c >= 0 && isdigit(c); c = x_e_getc(), first = 0) {
n = n * 10 + (c - '0');
+ if (n < 0 || n > LINE) {
+ c = -1;
+ break;
+ }
+ }
if (c < 0 || first) {
x_e_putc(BEL);
x_arg = 1;