pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Detect integer overflow in array_set_slice().
7+ messages / 1 participants
[nested] [flat]

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/991f8cf8abe244547093ddffcc4b9209076f3525

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/657e54a05859d51e0afb6e44557b5e8622ecd1fe

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/547dd2cbda12a7316c796999d24e6b3a4338e4a6

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/670fb9f187cd75b6928cc044897a1f468439e19d

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6c1b71bc6abee45bd88334a343ae62f8fbeb327d

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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

* pgsql: Detect integer overflow in array_set_slice().
@ 2024-07-24 03:02 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Nathan Bossart @ 2024-07-24 03:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Detect integer overflow in array_set_slice().

When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

        INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/878e8c6be7ab2523b3dcbe238578e95162f521e9

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c   | 9 ++++++++-
src/test/regress/expected/arrays.out | 4 ++++
src/test/regress/sql/arrays.sql      | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)



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


end of thread, other threads:[~2024-07-24 03:02 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>
2024-07-24 03:02 pgsql: Detect integer overflow in array_set_slice(). Nathan Bossart <nathan@postgresql.org>

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