pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Guard against overflow in interval_mul() and interval_div().
6+ messages / 1 participants
[nested] [flat]

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 103 +++++++++++++++++++--------------
src/test/regress/expected/interval.out |  13 +++++
src/test/regress/sql/interval.sql      |   8 +++
3 files changed, 80 insertions(+), 44 deletions(-)



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

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2ffcebdba4cfa70fb1b6049ce85343e569304049

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 69 +++++++++++++++++++++++-----------
src/test/regress/expected/interval.out | 13 +++++++
src/test/regress/sql/interval.sql      |  8 ++++
3 files changed, 69 insertions(+), 21 deletions(-)



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

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2851aa7d1fc3bd3dfac00ff2250a7e029ed6499f

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 69 +++++++++++++++++++++++-----------
src/test/regress/expected/interval.out | 13 +++++++
src/test/regress/sql/interval.sql      |  8 ++++
3 files changed, 69 insertions(+), 21 deletions(-)



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

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 70 ++++++++++++++++++++++++----------
src/test/regress/expected/interval.out | 13 +++++++
src/test/regress/sql/interval.sql      |  8 ++++
3 files changed, 70 insertions(+), 21 deletions(-)



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

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/72d0c135bd7a9ab4602ea1bece0054bb1e8d372d

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 69 +++++++++++++++++++++++-----------
src/test/regress/expected/interval.out | 13 +++++++
src/test/regress/sql/interval.sql      |  8 ++++
3 files changed, 69 insertions(+), 21 deletions(-)



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

* pgsql: Guard against overflow in interval_mul() and interval_div().
@ 2023-11-18 14:52  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-11-18 14:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against overflow in interval_mul() and interval_div().

Commits 146604ec43 and a898b409f6 added overflow checks to
interval_mul(), but not to interval_div(), which contains almost
identical code, and so is susceptible to the same kinds of
overflows. In addition, those checks did not catch all possible
overflow conditions.

Add additional checks to the "cascade down" code in interval_mul(),
and copy all the overflow checks over to the corresponding code in
interval_div(), so that they both generate "interval out of range"
errors, rather than returning bogus results.

Given that these errors are relatively easy to hit, back-patch to all
supported branches.

Per bug #18200 from Alexander Lakhin, and subsequent investigation.

Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/428770aadca974dd08d4dd002567edd79cd0e940

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 70 ++++++++++++++++++++++++----------
src/test/regress/expected/interval.out | 13 +++++++
src/test/regress/sql/interval.sql      |  8 ++++
3 files changed, 70 insertions(+), 21 deletions(-)



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


end of thread, other threads:[~2023-11-18 14:52 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>
2023-11-18 14:52 pgsql: Guard against overflow in interval_mul() and interval_div(). Dean Rasheed <dean.a.rasheed@gmail.com>

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