pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
Date: Sat, 29 Apr 2023 17:07:02 +0000
Message-ID: <E1pso2H-005We4-Io@gemulon.postgresql.org> (raw)

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



view thread (12+ messages)  latest in thread

Message-ID: <E1pso2H-005We4-Io@gemulon.postgresql.org>
Permalink:  ../E1pso2H-005We4-Io@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pso2H-005We4-Io@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Tighten array dimensionality checks in Perl -> SQL array convers
  In-Reply-To: <E1pso2H-005We4-Io@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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