Re: BUG #5416: int4inc() is wrong

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: John Regehr <regehr(at)cs(dot)utah(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5416: int4inc() is wrong
Date: 2010-05-31 20:21:37
Message-ID: 201005312021.o4VKLb421676@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

John Regehr wrote:
> Hi Tom,
>
> > If you can show me rewrites of all the basic arithmetic operations that
> > detect overflow in full compliance with the C standard, and are
> > readable, portable, and efficient, I'm all ears.
>
> These are the best ones that I know of:
>
> https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
>
> Even if you dislike these, please take a look at the safety checks for
> shifts. The current postgresql shift functions need to be strengthened,
> and it is easy to do.

Added to TODO:

Consider improving overflow detection

* http://archives.postgresql.org/message-id/4BC66A57.2030809@cs.utah.edu

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-05-31 20:30:13 Re: BUG #5416: int4inc() is wrong
Previous Message Bruce Momjian 2010-05-31 14:12:55 Re: BUG #5469: regexp_matches() has poor behaviour and more poor documentation