From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Protect against overflow of ltree.numlevel and lquery.numlevel.
Date: Sat, 28 Mar 2020 21:10:11 +0000
Message-ID: <E1jIIiZ-0003Hu-Bz@gemulon.postgresql.org> (raw)
Protect against overflow of ltree.numlevel and lquery.numlevel.
These uint16 fields could be overflowed by excessively long input,
producing strange results. Complain for invalid input.
Likewise check for out-of-range values of the repeat counts in lquery.
(We don't try too hard on that one, notably not bothering to detect
if atoi's result has overflowed.)
Also detect length overflow in ltree_concat.
In passing, be more consistent about whether "syntax error" messages
include the type name. Also, clarify the documentation about what
the size limit is.
This has been broken for a long time, so back-patch to all supported
branches.
Nikita Glukhov, reviewed by Benjie Gillam and Tomas Vondra
Discussion: https://postgr.es/m/CAP_rww=waX2Oo6q+MbMSiZ9ktdj6eaJj0cQzNu=Ry2cCDij5fw@mail.gmail.com
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5feb3d0b3f6bf2f65757acbad6578cc8318f1f70
Modified Files
--------------
contrib/ltree/expected/ltree.out | 46 ++++++++++++++++++++++++++++++++++
contrib/ltree/ltree.h | 2 ++
contrib/ltree/ltree_io.c | 54 ++++++++++++++++++++++++++--------------
contrib/ltree/ltree_op.c | 9 ++++++-
contrib/ltree/sql/ltree.sql | 11 ++++++++
doc/src/sgml/ltree.sgml | 3 +--
6 files changed, 104 insertions(+), 21 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Protect against overflow of ltree.numlevel and lquery.numlevel.
In-Reply-To: <E1jIIiZ-0003Hu-Bz@gemulon.postgresql.org>
References: <E1jIIiZ-0003Hu-Bz@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