[COMMITTERS] pgsql: Tighten checks for whitespace in functions that parseidentifier - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Tighten checks for whitespace in functions that parseidentifier
Date
Msg-id E1dDbxn-0004fS-Og@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Tighten checks for whitespace in functions that parse identifiers etc.

This patch replaces isspace() calls with scanner_isspace() in functions
that are likely to be presented with non-ASCII input.  isspace() has
the small advantage that it will correctly recognize no-break space
in single-byte encodings (such as LATIN1); but it cannot work successfully
for any multibyte character, and depending on platform it might return
false positive results for some fragments of multibyte characters.  That's
disastrous for functions that are trying to discard whitespace between
valid strings, as noted in bug #14662 from Justin Muise.  Even treating
no-break space as whitespace is pretty questionable for the usages touched
here, because the core scanner would think it is an identifier character.

Affected functions are parse_ident(), parseNameAndArgTypes (underlying
regprocedurein() and siblings), SplitIdentifierString (used for parsing
GUCs and options that are qualified names or lists of names), and
SplitDirectoriesString (used for parsing GUCs that are lists of
directories).

All the functions adjusted here are parsing SQL identifiers and similar
constructs, so it's reasonable to insist that their definition of
whitespace match the core scanner.  So we can hope that this won't cause
many backwards-compatibility problems.  I've left alone isspace() calls
in places that aren't really expecting any non-ASCII input characters,
such as float8in().

Back-patch to all supported branches.

Discussion: https://postgr.es/m/10129.1495302480@sss.pgh.pa.us

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/971a158e67fd12af13595bc6baeda9ad2a189144

Modified Files
--------------
src/backend/utils/adt/regproc.c |  7 ++++---
src/backend/utils/adt/varlena.c | 16 ++++++++--------
2 files changed, 12 insertions(+), 11 deletions(-)


pgsql-committers by date:

Previous
From: Magnus Hagander
Date:
Subject: [COMMITTERS] pgsql: Update URLs in pgindent source and README
Next
From: Robert Haas
Date:
Subject: [COMMITTERS] pgsql: Code review of get_qual_for_list.