# HG changeset patch # User Bryan O'Sullivan # Date 2005-09-04 06:51:53 # Node ID 8deb69818e4b5ba102c0570e3560bff9c0a37428 # Parent 3738e85ead07d2a8b83b345c3132443c5c2bfe6f Date validation must check for 32-bit width. Don't use assert to check. diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -33,10 +33,13 @@ class changelog(revlog): user=None, date=None): if date: # validate explicit (probably user-specified) date and - # time zone offset + # time zone offset. values must fit in signed 32 bits for + # current 32-bit linux runtimes. when, offset = map(int, date.split(' ')) - time.localtime(when) - assert abs(offset) < 43200, 'bad time zone offset: %d' % offset + if abs(when) > 0x7fffffff: + raise ValueError('date exceeds 32 bits: %d' % when) + if abs(offset) >= 43200: + raise ValueError('impossible time zone offset: %d' % offset) else: if time.daylight: offset = time.altzone else: offset = time.timezone