Re: Strange interval arithmetic - Mailing list pgsql-hackers

From Michael Fuhr
Subject Re: Strange interval arithmetic
Date
Msg-id 20051130182806.GA98044@winnie.fuhr.org
Whole thread Raw
In response to Re: Strange interval arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Strange interval arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Nov 30, 2005 at 12:37:40PM -0500, Tom Lane wrote:
> Michael Fuhr <mike@fuhr.org> writes:
> >> I see this behavior back to at least 7.3.  I'd guess it's because
> >> strtol() indicates overflow by returning LONG_MAX and setting errno
> >> to ERANGE, but the code doesn't check for that.
> 
> > Is this worth looking at for the upcoming dot releases?
> 
> Sure, send a patch ...

Any preferences on an approach?  The simplest and easiest to verify
would be to raise an error for just this particular case; a TODO
item might be to change how the string is parsed to allow values
larger than LONG_MAX.  I see several calls to strtol() that aren't
checked for overflow but that might not be relevant to this problem,
so I'm thinking this patch ought not touch them.  Maybe that's another
TODO item.

-- 
Michael Fuhr


pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: Upcoming PG re-releases
Next
From: "Marc G. Fournier"
Date:
Subject: Re: [pgsql-www] Upcoming PG re-releases