Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-bugs by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group