summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorK. Handa <handa@gnu.org>2016-06-01 09:16:32 +0900
committerK. Handa <handa@gnu.org>2016-06-01 09:16:32 +0900
commit8e22067d59f59ee3a39f5d4f95c27e8ea3c935d6 (patch)
tree98c0480e0765c4f2b3d24ff5a1617e64a9109d80 /lisp/subr.el
parent6d66089127313a1c5b5c5584eaf3e9edec010955 (diff)
parent25cc0f2aada3e321e5f1c6d1e492a93d16da45b2 (diff)
downloademacs-8e22067d59f59ee3a39f5d4f95c27e8ea3c935d6.tar.gz
emacs-8e22067d59f59ee3a39f5d4f95c27e8ea3c935d6.tar.bz2
emacs-8e22067d59f59ee3a39f5d4f95c27e8ea3c935d6.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 6e679e70f7e..b66ff288b7a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -486,13 +486,16 @@ of course, also replace TO with a slightly larger value
(list from)
(or inc (setq inc 1))
(when (zerop inc) (error "The increment can not be zero"))
- (let (seq (n 0) (next from))
+ (let (seq (n 0) (next from) (last from))
(if (> inc 0)
- (while (<= next to)
+ ;; The (>= next last) condition protects against integer
+ ;; overflow in computing NEXT.
+ (while (and (>= next last) (<= next to))
(setq seq (cons next seq)
n (1+ n)
+ last next
next (+ from (* n inc))))
- (while (>= next to)
+ (while (and (<= next last) (>= next to))
(setq seq (cons next seq)
n (1+ n)
next (+ from (* n inc)))))