[PATCH] util: fix crash converting an invalid future date to string

Matt Mackall mpm at selenic.com
Fri Sep 23 16:15:34 CDT 2011


On Fri, 2011-09-23 at 11:45 -0400, Kevin Gessner wrote:
> # HG changeset patch
> # User Kevin Gessner <kevin at fogcreek.com>
> # Date 1316793747 25200
> # Node ID 74c597ca2fcf83e88c746c7d902b4152e6b818b8
> # Parent  91dc8878f88857f01b86a99ad047400704b5fd7e
> util: fix crash converting an invalid future date to string
> 
> Post-2038 timestamps cannot be handled on 32-bit architectures. Clamp
> such dates to the maximum 32-bit timestamp.

> +    try:
> +        t = time.gmtime(float(t) - tz)
> +    except ValueError:
> +        # time was out of range
> +        t = time.gmtime(sys.maxint)

Looks like that will do the wrong thing with timestamps from the past?

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list