pgsql: Fix integer-overflow edge case detection in interval_mul and pgb

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
Дата
Msg-id E1iSkZ6-0005Qy-A3@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix integer-overflow edge case detection in interval_mul and pgbench.

This patch adopts the overflow check logic introduced by commit cbdb8b4c0
into two more places.  interval_mul() failed to notice if it computed a
new microseconds value that was one more than INT64_MAX, and pgbench's
double-to-int64 logic had the same sorts of edge-case problems that
cbdb8b4c0 fixed in the core code.

To make this easier to get right in future, put the guts of the checks
into new macros in c.h, and add commentary about how to use the macros
correctly.

Back-patch to all supported branches, as we did with the previous fix.

Yuya Watari

Discussion: https://postgr.es/m/CAJ2pMkbkkFw2hb9Qb1Zj8d06EhWAQXFLy73St4qWv6aX=vqnjw@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f6e72dc9cc8b8f480ea4a982662c3695ddc5a549

Modified Files
--------------
src/backend/utils/adt/float.c          | 44 +++++++---------------------------
src/backend/utils/adt/int8.c           | 22 ++++-------------
src/backend/utils/adt/timestamp.c      |  2 +-
src/bin/pgbench/pgbench.c              |  4 ++--
src/include/c.h                        | 24 +++++++++++++++++++
src/test/regress/expected/interval.out |  3 +++
src/test/regress/sql/interval.sql      |  3 +++
7 files changed, 45 insertions(+), 57 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: pgsql: doc: Further clarify how recovery target parameters areapplied
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: pgsql: doc: Further clarify how recovery target parameters are applied