From ab1ce9d7e2d5bda36e361583237e0b76a4a17298 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Mon, 20 Feb 2012 16:06:52 +0800 Subject: [PATCH] Check FROM arg to substring in icomplete-completions See: http://debbugs.gnu.org/10850 --- lisp/ChangeLog | 5 +++++ lisp/icomplete.el | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cc5851373b0..629b5b19d93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-02-20 Leo Liu + + * icomplete.el (icomplete-completions): Check FROM arg before + passing to substring (Bug#10850). + 2012-02-19 Chong Yidong * comint.el: Require ansi-color. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 80a0bf1435b..a9719651957 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)) -- 2.39.2