From 703eb4d13016090d1b50294faaf9b57c6ed9a738 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 5 Oct 2020 16:07:27 +0200 Subject: Correctly handle invalid UTF-16 code points Some code points are reserved for the UTF-16 coding itself and must not appear as input data to the algorithm. --- common/rfb/util.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index cc5b7690..ecab8485 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -314,7 +314,7 @@ namespace rfb { *dst++ = src; *dst++ = L'\0'; return 1; - } else if (src < 0x110000) { + } else if ((src >= 0x10000) && (src < 0x110000)) { src -= 0x10000; *dst++ = 0xd800 | ((src >> 10) & 0x03ff); *dst++ = 0xdc00 | (src & 0x03ff); -- cgit v1.2.3