Re: Fix for Win32 division involving INT_MIN
От | Bruce Momjian |
---|---|
Тема | Re: Fix for Win32 division involving INT_MIN |
Дата | |
Msg-id | 200606121609.k5CG9Ci07661@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Fix for Win32 division involving INT_MIN (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-patches |
Patch applied. Backpatch to 8.1.X. --------------------------------------------------------------------------- Bruce Momjian wrote: > Tom Lane wrote: > > 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? > > Seems int8 is OK on Win32: > > postgres=# SELECT (-9223372036854775808) / (-1); > ERROR: bigint out of range > > > Also, the overflow tests in the intNmul routines seem vulnerable. > > I reproduced the crash using int4 multiplication. Again int8 > multiplication seemed OK. > > I tried int2 and that seemed OK. > > Updated patch attached. > > -- > Bruce Momjian http://candle.pha.pa.us > EnterpriseDB http://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match -- Bruce Momjian http://candle.pha.pa.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
В списке pgsql-patches по дате отправления: