summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calendar/parse-time.el2
-rw-r--r--lisp/calendar/time-date.el19
-rw-r--r--lisp/url/ChangeLog6
-rw-r--r--lisp/url/url-cookie.el4
5 files changed, 31 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8c7ac9c7423..28fa5d1a5e6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-08-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't mishandle year-9999 dates (Bug#18176).
+ * calendar/parse-time.el (parse-time-rules):
+ Allow years up to most-positive-fixnum.
+ * calendar/time-date.el (date-to-time):
+ Pass "Specified time is not representable" errors through.
+
2014-08-02 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el: Completion code cleanups.
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 6bfccec94c6..6c88210030b 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -131,7 +131,7 @@
`(((6) parse-time-weekdays)
((3) (1 31))
((4) parse-time-months)
- ((5) (100 4038))
+ ((5) (100 ,most-positive-fixnum))
((2 1 0)
,#'(lambda () (and (stringp parse-time-elt)
(= (length parse-time-elt) 8)
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index b04cfcd9fe4..48fe2294354 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -119,13 +119,20 @@ it is assumed that PICO was omitted and should be treated as zero."
(defun date-to-time (date)
"Parse a string DATE that represents a date-time and return a time value.
If DATE lacks timezone information, GMT is assumed."
- (condition-case ()
+ (condition-case err
(apply 'encode-time (parse-time-string date))
- (error (condition-case ()
- (apply 'encode-time
- (parse-time-string
- (timezone-make-date-arpa-standard date)))
- (error (error "Invalid date: %s" date))))))
+ (error
+ (let ((overflow-error '(error "Specified time is not representable")))
+ (if (equal err overflow-error)
+ (apply 'signal err)
+ (condition-case err
+ (apply 'encode-time
+ (parse-time-string
+ (timezone-make-date-arpa-standard date)))
+ (error
+ (if (equal err overflow-error)
+ (apply 'signal err)
+ (error "Invalid date: %s" date)))))))))
;; Bit of a mess. Emacs has float-time since at least 21.1.
;; This file is synced to Gnus, and XEmacs packages may have been written
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index b8e34ea65c4..92945b37951 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't mishandle dates in the year 9999 (Bug#18176).
+ * url-cookie.el (url-cookie-expired-p): Treat out-of-range
+ expiration dates as if they were far in the future.
+
2014-06-26 Leo Liu <sdl.web@gmail.com>
* url-http.el (url-http-end-of-headers): Remove duplicate defvar.
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 55e0fb33951..f89886b95dd 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -158,7 +158,9 @@ telling Microsoft that."
"Return non-nil if COOKIE is expired."
(let ((exp (url-cookie-expires cookie)))
(and (> (length exp) 0)
- (> (float-time) (float-time (date-to-time exp))))))
+ (condition-case ()
+ (> (float-time) (float-time (date-to-time exp)))
+ (error nil)))))
(defun url-cookie-retrieve (host &optional localpart secure)
"Retrieve all cookies for a specified HOST and LOCALPART."