Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 28864:b0811a9fe67c
date: fix boundary check of negative integer
author | Florent Gallaire <fgallaire@gmail.com> |
---|---|
date | Tue, 12 Apr 2016 00:30:28 +0200 |
parents | 68a946e83188 |
children | 16255662446d |
line wrap: on
line diff
--- a/mercurial/util.py Sun Apr 10 22:00:34 2016 +0100 +++ b/mercurial/util.py Tue Apr 12 00:30:28 2016 +0200 @@ -1595,8 +1595,8 @@ d = t - tz if d > 0x7fffffff: d = 0x7fffffff - elif d < -0x7fffffff: - d = -0x7fffffff + elif d < -0x80000000: + d = -0x80000000 # Never use time.gmtime() and datetime.datetime.fromtimestamp() # because they use the gmtime() system call which is buggy on Windows # for negative values. @@ -1720,7 +1720,7 @@ # time zone offset. values must fit in signed 32 bits for # current 32-bit linux runtimes. timezones go from UTC-12 # to UTC+14 - if abs(when) > 0x7fffffff: + if when < -0x80000000 or when > 0x7fffffff: raise Abort(_('date exceeds 32 bits: %d') % when) if offset < -50400 or offset > 43200: raise Abort(_('impossible time zone offset: %d') % offset)