pgsql: Fix possible internal overflow in numeric multiplication.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix possible internal overflow in numeric multiplication.
Дата
Msg-id E1Ze3iS-0005aE-K6@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix possible internal overflow in numeric multiplication.

mul_var() postpones propagating carries until it risks overflow in its
internal digit array.  However, the logic failed to account for the
possibility of overflow in the carry propagation step, allowing wrong
results to be generated in corner cases.  We must slightly reduce the
when-to-propagate-carries threshold to avoid that.

Discovered and fixed by Dean Rasheed, with small adjustments by me.

This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b,
so back-patch to all supported branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/246693e5ae8a36f015294aa8c73dbbf0d4e542a8

Modified Files
--------------
src/backend/utils/adt/numeric.c       |   14 ++++++++++----
src/test/regress/expected/numeric.out |   27 +++++++++++++++++++++++++++
src/test/regress/sql/numeric.sql      |   12 ++++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix possible internal overflow in numeric multiplication.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix possible internal overflow in numeric multiplication.