aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2014-08-03 08:38:52 -0700
committerPaul Eggert2014-08-03 08:38:52 -0700
commit308cc448e5d6ffd44c7ff366a99d34bbfb0e8c4d (patch)
tree04e83c1f35b94135a52711a5934e752fffea5c3d /lisp
parent8f88f7d3c5da38cd2d781770b533dc6c93c52d59 (diff)
downloademacs-308cc448e5d6ffd44c7ff366a99d34bbfb0e8c4d.tar.gz
emacs-308cc448e5d6ffd44c7ff366a99d34bbfb0e8c4d.zip
Don't mishandle year-9999 dates.
* lisp/calendar/parse-time.el (parse-time-rules): Allow years up to most-positive-fixnum. * lisp/calendar/time-date.el (date-to-time): Pass "Specified time is not representable" errors through. * lisp/url/url-cookie.el (url-cookie-expired-p): Treat out-of-range expiration dates as if they were far in the future. * src/editfns.c (decode_time_components): Store an invalid timespec on overflow, instead of returning false, so that the caller can distinguish overflow from other errors. (lisp_time_argument, lisp_seconds_argument): If the time is out of range, signal a time overflow instead of an invalid time spec. * src/keyboard.c (decode_timer): Treat time overflow like other timespec errors. Fixes: debbugs:18176
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 @@
12014-08-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 Don't mishandle year-9999 dates (Bug#18176).
4 * calendar/parse-time.el (parse-time-rules):
5 Allow years up to most-positive-fixnum.
6 * calendar/time-date.el (date-to-time):
7 Pass "Specified time is not representable" errors through.
8
12014-08-02 Fabián Ezequiel Gallina <fgallina@gnu.org> 92014-08-02 Fabián Ezequiel Gallina <fgallina@gnu.org>
2 10
3 * progmodes/python.el: Completion code cleanups. 11 * 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 @@
131 `(((6) parse-time-weekdays) 131 `(((6) parse-time-weekdays)
132 ((3) (1 31)) 132 ((3) (1 31))
133 ((4) parse-time-months) 133 ((4) parse-time-months)
134 ((5) (100 4038)) 134 ((5) (100 ,most-positive-fixnum))
135 ((2 1 0) 135 ((2 1 0)
136 ,#'(lambda () (and (stringp parse-time-elt) 136 ,#'(lambda () (and (stringp parse-time-elt)
137 (= (length parse-time-elt) 8) 137 (= (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."
119(defun date-to-time (date) 119(defun date-to-time (date)
120 "Parse a string DATE that represents a date-time and return a time value. 120 "Parse a string DATE that represents a date-time and return a time value.
121If DATE lacks timezone information, GMT is assumed." 121If DATE lacks timezone information, GMT is assumed."
122 (condition-case () 122 (condition-case err
123 (apply 'encode-time (parse-time-string date)) 123 (apply 'encode-time (parse-time-string date))
124 (error (condition-case () 124 (error
125 (apply 'encode-time 125 (let ((overflow-error '(error "Specified time is not representable")))
126 (parse-time-string 126 (if (equal err overflow-error)
127 (timezone-make-date-arpa-standard date))) 127 (apply 'signal err)
128 (error (error "Invalid date: %s" date)))))) 128 (condition-case err
129 (apply 'encode-time
130 (parse-time-string
131 (timezone-make-date-arpa-standard date)))
132 (error
133 (if (equal err overflow-error)
134 (apply 'signal err)
135 (error "Invalid date: %s" date)))))))))
129 136
130;; Bit of a mess. Emacs has float-time since at least 21.1. 137;; Bit of a mess. Emacs has float-time since at least 21.1.
131;; This file is synced to Gnus, and XEmacs packages may have been written 138;; 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 @@
12014-08-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 Don't mishandle dates in the year 9999 (Bug#18176).
4 * url-cookie.el (url-cookie-expired-p): Treat out-of-range
5 expiration dates as if they were far in the future.
6
12014-06-26 Leo Liu <sdl.web@gmail.com> 72014-06-26 Leo Liu <sdl.web@gmail.com>
2 8
3 * url-http.el (url-http-end-of-headers): Remove duplicate defvar. 9 * 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."
158 "Return non-nil if COOKIE is expired." 158 "Return non-nil if COOKIE is expired."
159 (let ((exp (url-cookie-expires cookie))) 159 (let ((exp (url-cookie-expires cookie)))
160 (and (> (length exp) 0) 160 (and (> (length exp) 0)
161 (> (float-time) (float-time (date-to-time exp)))))) 161 (condition-case ()
162 (> (float-time) (float-time (date-to-time exp)))
163 (error nil)))))
162 164
163(defun url-cookie-retrieve (host &optional localpart secure) 165(defun url-cookie-retrieve (host &optional localpart secure)
164 "Retrieve all cookies for a specified HOST and LOCALPART." 166 "Retrieve all cookies for a specified HOST and LOCALPART."