aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2012-02-20 16:06:52 +0800
committerLeo Liu <[email protected]>2012-02-20 16:06:52 +0800
commitab1ce9d7e2d5bda36e361583237e0b76a4a17298 (patch)
tree9677815d64a89d6a82a0fa17c3a4d27657c38096
parentb0668aa847fc5112debd686291aa457d252482e1 (diff)
Check FROM arg to substring in icomplete-completions
See: http://debbugs.gnu.org/10850
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/icomplete.el4
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc5851373b..629b5b19d9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-20 Leo Liu <[email protected]>
+
+ * icomplete.el (icomplete-completions): Check FROM arg before
+ passing to substring (Bug#10850).
+
2012-02-19 Chong Yidong <[email protected]>
* comint.el: Require ansi-color.
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 80a0bf1435..a971965195 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -347,7 +347,9 @@ are exhibited within the square braces.)"
(setq prospects nil)
(while (and comps (not limit))
(setq comp
- (if prefix-len (substring (car comps) prefix-len) (car comps))
+ (if (and prefix-len (<= prefix-len (length (car comps))))
+ (substring (car comps) prefix-len)
+ (car comps))
comps (cdr comps))
(cond ((string-equal comp "") (setq most-is-exact t))
((member comp prospects))