Re: Strange interval arithmetic

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Strange interval arithmetic
Date: 2005-11-30 18:28:07
Message-ID: 20051130182806.GA98044@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, Nov 30, 2005 at 12:37:40PM -0500, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2005-11-30 18:30:57 Re: [HACKERS] Upcoming PG re-releases
Previous Message Robert Treat 2005-11-30 18:23:38 Re: [HACKERS] Upcoming PG re-releases

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-11-30 19:01:46 Re: Strange interval arithmetic
Previous Message Tom Lane 2005-11-30 17:37:40 Re: Strange interval arithmetic