BUG #5416: int4inc() is wrong

Поиск
Список
Период
Сортировка
От John Regehr
Тема BUG #5416: int4inc() is wrong
Дата
Msg-id 201004130544.o3D5iS45040175@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5416: int4inc() is wrong  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5416
Logged by:          John Regehr
Email address:      regehr@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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Possible alpha5 SR bug
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: BUG #5418: psql exits after using tab-completion with error message