The following bug has been logged online: Bug reference: 5416 Logged by: John Regehr Email address: reg...@cs.utah.edu PostgreSQL version: git head Apr 12 Operating system: n/a Description: int4inc() is wrong Details:
The overflow check in int4inc() from int.c is wrong. The problem is that in C, signed overflow is undefined. Both LLVM and GCC eliminate the overflow check in this function. This is easy to see by looking at the asm emitted by either compiler. There are several easy ways to fix this code. One would be to test arg against INT_MAX before incrementing. Another would be to cast arg to unsigned, increment it, then do the check. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs