##// END OF EJS Templates
Date validation must check for 32-bit width. Don't use assert to check.
Bryan O'Sullivan -
r1197:8deb6981 default
parent child Browse files
Show More
@@ -33,10 +33,13 class changelog(revlog):
33 user=None, date=None):
33 user=None, date=None):
34 if date:
34 if date:
35 # validate explicit (probably user-specified) date and
35 # validate explicit (probably user-specified) date and
36 # time zone offset
36 # time zone offset. values must fit in signed 32 bits for
37 # current 32-bit linux runtimes.
37 when, offset = map(int, date.split(' '))
38 when, offset = map(int, date.split(' '))
38 time.localtime(when)
39 if abs(when) > 0x7fffffff:
39 assert abs(offset) < 43200, 'bad time zone offset: %d' % offset
40 raise ValueError('date exceeds 32 bits: %d' % when)
41 if abs(offset) >= 43200:
42 raise ValueError('impossible time zone offset: %d' % offset)
40 else:
43 else:
41 if time.daylight: offset = time.altzone
44 if time.daylight: offset = time.altzone
42 else: offset = time.timezone
45 else: offset = time.timezone
General Comments 0
You need to be logged in to leave comments. Login now