From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Ensure maxlen is at leat 1 in dict_int
Date: Tue, 03 Dec 2019 17:42:38 +0000
Message-ID: <E1icCC6-0006NN-2z@gemulon.postgresql.org> (raw)
Ensure maxlen is at leat 1 in dict_int
The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does
txt[d->maxlen] = '\0';
to insert a terminator, leading to segfaults with negative values.
This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.
Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/fabdad822287d6aac6a80fc57a97d38bd7456958
Modified Files
--------------
contrib/dict_int/dict_int.c | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql | 2 ++
3 files changed, 9 insertions(+)
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: tomas.vondra@postgresql.org
Subject: Re: pgsql: Ensure maxlen is at leat 1 in dict_int
In-Reply-To: <E1icCC6-0006NN-2z@gemulon.postgresql.org>
References: <E1icCC6-0006NN-2z@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