diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-04-25 20:35:51 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-04-25 20:35:51 +0000 |
commit | 0d99c95388a7edc4ddb8897776e80de00944ded0 (patch) | |
tree | 86577adab69447605b6641a9ccb96c2a6de22e67 /src | |
parent | 2acfc4f6b4cbd3c69ba399d5d1f52730411e5508 (diff) | |
download | postgresql-0d99c95388a7edc4ddb8897776e80de00944ded0.tar.gz postgresql-0d99c95388a7edc4ddb8897776e80de00944ded0.zip |
Correct potential infinite loop in pg_utf2wchar_with_len;
it failed to cover the case where high bits of char are 100 or 101.
Not sure if fix is right, but it agrees with pg_utf_mblen ... and it
doesn't lock up ...
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/mb/wchar.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c index 78f22c15ebc..2fc856d1b5d 100644 --- a/src/backend/utils/mb/wchar.c +++ b/src/backend/utils/mb/wchar.c @@ -1,7 +1,7 @@ /* * conversion functions between pg_wchar and multi-byte streams. * Tatsuo Ishii - * $Id: wchar.c,v 1.6 1999/03/24 07:02:17 ishii Exp $ + * $Id: wchar.c,v 1.7 1999/04/25 20:35:51 tgl Exp $ */ #include "mb/pg_wchar.h" @@ -268,6 +268,11 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar * to, int len) *to |= c2 << 6; *to |= c3; } + else + { + *to = *from++; + len--; + } to++; } *to = 0; |