postgresql/src/backend/utils
Tom Lane 03d1281477 Get pg_utf_mblen(), pg_utf2wchar_with_len(), and utf2ucs() all on the same
page about the maximum UTF8 sequence length we support (4 bytes since 8.1,
3 before that).  pg_utf2wchar_with_len never got updated to support 4-byte
characters at all, and in any case had a buffer-overrun risk in that it
could produce multiple pg_wchars from what mblen claims to be just one UTF8
character.  The only reason we don't have a major security hole is that most
callers allocate worst-case output buffers; the sole exception in released
versions appears to be pre-8.2 iwchareq() (ie, ILIKE), which can be crashed
due to zeroing out its return address --- but AFAICS that can't be exploited
for anything more than a crash, due to inability to control what gets written
there.  Per report from James Russell and Michael Fuhr.

Pre-8.1 the risk is much less, but I still think pg_utf2wchar_with_len's
behavior given an incomplete final character risks buffer overrun, so
back-patch that logic change anyway.

This patch also makes sure that UTF8 sequences exceeding the supported
length (whichever it is) are consistently treated as error cases, rather
than being treated like a valid shorter sequence in some places.
2007-01-24 17:12:29 +00:00
..
adt Fix regex_fixed_prefix() to cope reasonably well with regex patterns of the 2007-01-03 22:39:42 +00:00
cache Fix recently-identified PITR recovery hazard: the base backup could contain 2006-11-05 23:40:38 +00:00
error Re-run pgindent, fixing a problem where comment lines after a blank 2005-11-22 18:23:31 +00:00
fmgr Repair problems with the result of lookup_rowtype_tupdesc() possibly being 2006-01-17 17:33:23 +00:00
hash Tweak dynahash.c to avoid wasting memory space in non-shared hash tables. 2006-06-25 18:29:56 +00:00
init Fix recently-identified PITR recovery hazard: the base backup could contain 2006-11-05 23:40:38 +00:00
mb Get pg_utf_mblen(), pg_utf2wchar_with_len(), and utf2ucs() all on the same 2007-01-24 17:12:29 +00:00
misc Add a new GUC parameter backslash_quote, which determines whether the SQL 2006-05-21 20:11:02 +00:00
mmgr Re-run pgindent, fixing a problem where comment lines after a blank 2005-11-22 18:23:31 +00:00
resowner Fix bgwriter's failure to release buffer pins and open files after an 2005-12-08 19:19:31 +00:00
sort Re-run pgindent, fixing a problem where comment lines after a blank 2005-11-22 18:23:31 +00:00
time Repair two related errors in heap_lock_tuple: it was failing to recognize 2006-11-17 18:00:25 +00:00
.cvsignore Cleanup to ensure good state of derived files in tarballs. 2000-06-09 02:38:36 +00:00
Gen_fmgrtab.sh Tag appropriate files for rc3 2004-12-31 22:04:05 +00:00
Makefile Invent ResourceOwner mechanism as per my recent proposal, and use it to 2004-07-17 03:32:14 +00:00