diff lisp/net/imap.el @ 87209:bc4976b7380e

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-950
author Miles Bader <miles@gnu.org>
date Sun, 09 Dec 2007 22:14:32 +0000
parents b37f01064ecf
children 0cbc451989a7
line wrap: on
line diff
--- a/lisp/net/imap.el	Sun Dec 09 14:47:24 2007 +0000
+++ b/lisp/net/imap.el	Sun Dec 09 22:14:32 2007 +0000
@@ -1735,6 +1735,18 @@
 		  (concat "UID STORE " articles
 			  " +FLAGS" (if silent ".SILENT") " (" flags ")"))))))
 
+;; Cf. http://thread.gmane.org/gmane.emacs.gnus.general/65317/focus=65343
+;; Signal an error if we'd get an integer overflow.
+;;
+;; FIXME: Identify relevant calls to `string-to-number' and replace them with
+;; `imap-string-to-integer'.
+(defun imap-string-to-integer (string &optional base)
+  (let ((number (string-to-number string base)))
+    (if (> number most-positive-fixnum)
+	(error
+	 (format "String %s cannot be converted to a lisp integer" number))
+      number)))
+
 (defun imap-message-copyuid-1 (mailbox)
   (if (imap-capability 'UIDPLUS)
       (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox))