Re: Fix for Win32 division involving INT_MIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, Wang Haiyong <wanghaiyong(at)neusoft(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix for Win32 division involving INT_MIN
Date: 2006-06-09 02:18:04
Message-ID: 4877.1149819484@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-06-09 02:40:30 Re: Fix for Win32 division involving INT_MIN
Previous Message Bruce Momjian 2006-06-09 01:50:17 Fix for Win32 division involving INT_MIN

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-06-09 02:40:30 Re: Fix for Win32 division involving INT_MIN
Previous Message Bruce Momjian 2006-06-09 01:50:17 Fix for Win32 division involving INT_MIN