Re: Fix for Win32 division involving INT_MIN - Mailing list pgsql-patches

From Tom Lane
Subject Re: Fix for Win32 division involving INT_MIN
Date
Msg-id 4877.1149819484@sss.pgh.pa.us
Whole thread Raw
In response to Fix for Win32 division involving INT_MIN  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Fix for Win32 division involving INT_MIN
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> With no Win32 exception detection code in sight, I propose the following
> patch to prevent server crashes for unusual INT_MIN integer division.

The overflow code tries hard to avoid assuming it knows what INT_MIN and
INT_MAX are --- this is maybe not so important for int4 but it is for
int8 (because of our support for int8-less machines).  I don't
immediately see how to make this test without assuming you know the
value of INT_MIN, but we ought to try to come up with one.

We do see funny behavior on Intel chips even without Windows, so it'd
be better to not #ifdef WIN32 but use the same overflow test for
everyone.

I would imagine the same problem arises with int8, has anyone checked?
Also, the overflow tests in the intNmul routines seem vulnerable.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Fix for Win32 division involving INT_MIN
Next
From: Bruce Momjian
Date:
Subject: Re: Fix for Win32 division involving INT_MIN