From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reduce an unnecessary O(N^3) loop in lexer.
Date: Thu, 23 Aug 2018 20:48:54 +0000
Message-ID: <E1fswXG-0001Oq-RW@gemulon.postgresql.org> (raw)
Reduce an unnecessary O(N^3) loop in lexer.
The lexer's handling of operators contained an O(N^3) hazard when
dealing with long strings of + or - characters; it seems hard to
prevent this case from being O(N^2), but the additional N multiplier
was not needed.
Backpatch all the way since this has been there since 7.x, and it
presents at least a mild hazard in that trying to do Bind, PREPARE or
EXPLAIN on a hostile query could take excessive time (without
honouring cancels or timeouts) even if the query was never executed.
Branch
------
REL9_3_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/9923c934df437dd4a83b2b9921d314d8bfb292b3
Modified Files
--------------
src/backend/parser/scan.l | 29 +++++++++++++++++++++--------
src/bin/psql/psqlscan.l | 29 +++++++++++++++++++++--------
src/interfaces/ecpg/preproc/pgc.l | 29 +++++++++++++++++++++--------
3 files changed, 63 insertions(+), 24 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: rhodiumtoad@postgresql.org
Subject: Re: pgsql: Reduce an unnecessary O(N^3) loop in lexer.
In-Reply-To: <E1fswXG-0001Oq-RW@gemulon.postgresql.org>
References: <E1fswXG-0001Oq-RW@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