Re: [HACKERS] Checking for overflow of integer arithmetic

2004-10-03 Thread Gaetano Mendola
Tom Lane wrote: { int32 arg1 = PG_GETARG_INT32(0); int32 arg2 = PG_GETARG_INT32(1); + int32 result; ! result = arg1 * arg2; ! /* ! * Overflow check. We basically check to see if result / arg2 gives ! * arg1 again. There are two cases where this fails: arg2 = 0 (which ! * ca

Re: [HACKERS] Checking for overflow of integer arithmetic

2004-10-03 Thread Bruno Wolff III
On Sun, Oct 03, 2004 at 15:38:52 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > 1. Does anyone object to applying this for 8.0? I think we already had > consensus that it's a good idea, but if not now's the time to speak up. > (There are a couple of regression tests that fail and will need to be >

Re: [HACKERS] Checking for overflow of integer arithmetic

2004-10-03 Thread Dave Page
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lane > Sent: 03 October 2004 20:39 > To: [EMAIL PROTECTED] > Subject: [HACKERS] Checking for overflow of integer arithmetic > > 2. For the int2 and int8 operators, should we stick to a > one-si