Changeset: 65609602b082 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65609602b082
Modified Files:
        clients/odbc/driver/ODBCUtil.c
Branch: Jul2012
Log Message:

Correct test for high and low surrogates encoded in UTF-8.
This should fix bug 3100.


diffs (22 lines):

diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -224,14 +224,14 @@ ODBCutf82wchar(const SQLCHAR *s,
                                c |= *s++ & 0x3F;
                        }
                }
-               if ((c & 0xF8) == 0xD8) {
-                       /* UTF-8 encoded high or low surrogate */
-                       return "Illegal code point";
-               }
                if (c > 0x10FFFF) {
                        /* cannot encode as UTF-16 */
                        return "Codepoint too large to be representable in 
UTF-16";
                }
+               if ((c & 0x1FFF800) == 0xD800) {
+                       /* UTF-8 encoded high or low surrogate */
+                       return "Illegal code point";
+               }
                if (c <= 0xFFFF) {
                        if (--buflen > 0 && p != NULL)
                                *p++ = c;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to