pgsql: Fix insufficiently-paranoid GB18030 encoding verifier.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix insufficiently-paranoid GB18030 encoding verifier.
Дата
Msg-id E1YtH9q-0006Fl-QY@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix insufficiently-paranoid GB18030 encoding verifier.

The previous coding effectively only verified that the second byte of a
multibyte character was in the expected range; moreover, it wasn't careful
to make sure that the second byte even exists in the buffer before touching
it.  The latter seems unlikely to cause any real problems in the field
(in particular, it could never be a problem with null-terminated input),
but it's still a bug.

Since GB18030 is not a supported backend encoding, the only thing we'd
really be doing with GB18030 text is converting it to UTF8 in LocalToUtf,
which would fail anyway on any invalid character for lack of a match in
its lookup table.  So the only user-visible consequence of this change
should be that you'll get "invalid byte sequence for encoding" rather than
"character has no equivalent" for malformed GB18030 input.  However,
impending changes to the GB18030 conversion code will require these tighter
up-front checks to avoid producing bogus results.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a868931fecdf93f3ceb1c9431bb93757b706269d

Modified Files
--------------
src/backend/utils/mb/wchar.c |   52 +++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 23 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: pgsql: Make repeated 'make installcheck' runs work
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Fix datatype confusion with the new lossy GiST distance function