pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/15783d057543edde84b537815a8f22cf99d4beaa

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              |  5 ++--
src/include/c.h                        | 24 +++++++++++++++++++
src/test/regress/expected/interval.out |  3 +++
src/test/regress/sql/interval.sql      |  3 +++
7 files changed, 46 insertions(+), 57 deletions(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5f794f7572e1ddbb64d076114c4a66c599bf4302

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              |  5 ++--
src/include/c.h                        | 24 +++++++++++++++++++
src/test/regress/expected/interval.out |  3 +++
src/test/regress/sql/interval.sql      |  3 +++
7 files changed, 46 insertions(+), 57 deletions(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_11_STABLE

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

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(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

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

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(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/84780d468023fdda42a178cf43eeda58e0da3a2b

Modified Files
--------------
src/backend/utils/adt/float.c          | 44 +++++++---------------------------
src/backend/utils/adt/int8.c           | 22 ++++-------------
src/backend/utils/adt/timestamp.c      |  2 +-
src/include/c.h                        | 24 +++++++++++++++++++
src/test/regress/expected/interval.out |  3 +++
src/test/regress/sql/interval.sql      |  3 +++
6 files changed, 43 insertions(+), 55 deletions(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



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

* pgsql: Fix integer-overflow edge case detection in interval_mul and pgb
@ 2019-11-07 16:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-11-07 16:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8d380864a523362777d325872997ae706d1d34e1

Modified Files
--------------
src/backend/utils/adt/float.c          | 44 +++++++---------------------------
src/backend/utils/adt/int8.c           | 22 ++++-------------
src/backend/utils/adt/timestamp.c      | 10 +-------
src/include/c.h                        | 25 +++++++++++++++++++
src/test/regress/expected/interval.out |  3 +++
src/test/regress/sql/interval.sql      |  3 +++
6 files changed, 44 insertions(+), 63 deletions(-)



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


end of thread, other threads:[~2019-11-07 16:23 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>
2019-11-07 16:23 pgsql: Fix integer-overflow edge case detection in interval_mul and pgb Tom Lane <tgl@sss.pgh.pa.us>

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