From 8d88ff2e11f3608ee582c576eba72aaf0b2226db Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 7 Jul 2009 13:50:09 -0500 Subject: Don't process surrogate pair chars These are not valid UCS2 chars --- src/util.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 91116d0d..e8177300 100644 --- a/src/util.c +++ b/src/util.c @@ -765,6 +765,10 @@ char *sim_string_to_utf8(const unsigned char *buffer, int length) if (buffer[i] & 0x80) { c = (buffer[i++] & 0x7f) + ucs2_offset; + + if (c >= 0xd800 && c < 0xe000) + return NULL; + res_len += UTF8_LENGTH(c); j += 1; continue; -- cgit v1.2.3