postgresql/src/backend/utils
Tom Lane 0887fa1117 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:17 +00:00
..
adt Simplify handling of XML error messages: Just use the string provided by 2007-01-23 23:39:16 +00:00
cache Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc 2007-01-22 01:35:23 +00:00
error Don't use 'int' where you mean 'bool'. 2007-01-20 21:40:25 +00:00
fmgr Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
hash Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
init Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
mb Get pg_utf_mblen(), pg_utf2wchar_with_len(), and utf2ucs() all on the same 2007-01-24 17:12:17 +00:00
misc Add documentation of memory and time units to postgresql.conf. 2007-01-20 21:42:03 +00:00
mmgr Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
resowner Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
sort Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
time Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
.cvsignore
Gen_fmgrtab.sh Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc 2007-01-22 01:35:23 +00:00
Makefile Fix some makefiles that fail to yield good results from 'make -qp'. 2006-07-15 03:33:14 +00:00
probes.d DTrace support, with a small initial set of probes 2006-07-24 16:32:45 +00:00