agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix missing money overflow checks for INT64_MIN / -1
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 05:59 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 05:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:00 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7746f7492d5b521f66af1e99cd42024cae8dde82

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:00 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6298a41b4e34773dbc0c50c26de825a4efe31f07

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:01 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1416f304d2c9514fe65f112514accc9b653902ad

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:01 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/86f42357c281bea857dc5c048beb08413622bf3b

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:01 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix missing money overflow checks for INT64_MIN / -1
@ 2026-08-04 06:02 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-08-04 06:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix missing money overflow checks for INT64_MIN / -1

Similar to what 1f7cb5c30 did for the INT types, protect against
overflow when dividing the lowest possible money value by -1.  This
cannot be represented on a two's complement machine.

Without this check, the result depends on the machine, and in the worst
case, could result in a crash.  With the fix installed, this will now
result in:

ERROR:  money out of range

Bug: #19585
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reported-by: Michael Malis <malis@pgrust.com>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/19586-bb603bf5ad9934dd%40postgresql.org
Discussion: https://postgr.es/m/CAB8bMisnXJVXte6s3kUOpuuAY9%3D9kehG6MMX-%2BTQoFsSGan22Q%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/utils/adt/cash.c        | 16 ++++++++++++++++
src/test/regress/expected/money.out |  8 ++++++++
src/test/regress/sql/money.sql      |  4 ++++
3 files changed, 28 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-08-04 06:02 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-04 05:59 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:00 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:00 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:01 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:01 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:01 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>
2026-08-04 06:02 pgsql: Fix missing money overflow checks for INT64_MIN / -1 David Rowley <drowley@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox