[COMMITTERS] pgsql: Tighten checks for whitespace in functions that parseidentifier

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Tighten checks for whitespace in functions that parseidentifier
Дата
Msg-id E1dDbxn-0004fS-Og@gemulon.postgresql.org
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: [COMMITTERS] pgsql: Update URLs in pgindent source and README
Следующее
От: Robert Haas
Дата:
Сообщение: [COMMITTERS] pgsql: Code review of get_qual_for_list.