pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
12+ messages / 1 participants
[nested] [flat]

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/900a8d526ff538d6cd03c3f52ba09fd4dc765915

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1e868bb6c67a19614c0f30b69bd5b624d72b1245

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
master

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

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
@ 2023-04-29 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-04-29 17:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Perl -> SQL array conversion.

plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]".  This is a bit related to the
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp.  Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.

Per report from Alexander Lakhin.  It's been broken for a long
time, so back-patch to all supported branches.

Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/pl/plperl/expected/plperl_array.out | 43 +++++++++++++++++++++++
src/pl/plperl/plperl.c                  | 62 +++++++++++++++++++++------------
src/pl/plperl/sql/plperl_array.sql      | 37 ++++++++++++++++++++
3 files changed, 119 insertions(+), 23 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out |  65 ++++++++-
src/pl/plpython/plpy_typeio.c               | 218 ++++++++++++++--------------
src/pl/plpython/sql/plpython_types.sql      |  50 ++++++-
3 files changed, 212 insertions(+), 121 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9d517339e9912d8e4afe76e26f9a0e5dc54f6f4e

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out   |  65 +++++++-
src/pl/plpython/expected/plpython_types_3.out |  65 +++++++-
src/pl/plpython/plpy_typeio.c                 | 218 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql        |  50 +++++-
4 files changed, 270 insertions(+), 128 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0553528e7c2bb9eb4148ff9e3c51b9094ab67f70

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out |  65 ++++++++-
src/pl/plpython/plpy_typeio.c               | 218 ++++++++++++++--------------
src/pl/plpython/sql/plpython_types.sql      |  50 ++++++-
3 files changed, 212 insertions(+), 121 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0e6354ed97833a15a6a7dfa328298ad02e0947e3

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out   |  65 +++++++-
src/pl/plpython/expected/plpython_types_3.out |  65 +++++++-
src/pl/plpython/plpy_typeio.c                 | 212 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql        |  50 +++++-
4 files changed, 270 insertions(+), 122 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out   |  65 +++++++-
src/pl/plpython/expected/plpython_types_3.out |  65 +++++++-
src/pl/plpython/plpy_typeio.c                 | 215 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql        |  50 +++++-
4 files changed, 273 insertions(+), 122 deletions(-)



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

* pgsql: Tighten array dimensionality checks in Python -> SQL array conve
@ 2023-05-04 15:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-04 15:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e.  It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out   |  65 +++++++-
src/pl/plpython/expected/plpython_types_3.out |  65 +++++++-
src/pl/plpython/plpy_typeio.c                 | 216 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql        |  50 +++++-
4 files changed, 274 insertions(+), 122 deletions(-)



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


end of thread, other threads:[~2023-05-04 15:00 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-04-29 17:07 pgsql: Tighten array dimensionality checks in Perl -> SQL array convers Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve Tom Lane <tgl@sss.pgh.pa.us>
2023-05-04 15:00 pgsql: Tighten array dimensionality checks in Python -> SQL array conve 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