summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2019-03-14 17:26:21 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2019-03-14 17:26:21 (GMT)
commitfb5de060bc99635a5b18b3389cc15e9937b19a0e (patch)
tree717ba5b7072330e1872b804ba62517d183e14584 /Source
parenta11e5e021b5c30a0d6490cfff0399a14a3fb798a (diff)
downloadCMake-fb5de060bc99635a5b18b3389cc15e9937b19a0e.zip
CMake-fb5de060bc99635a5b18b3389cc15e9937b19a0e.tar.gz
CMake-fb5de060bc99635a5b18b3389cc15e9937b19a0e.tar.bz2
cm_utf8: reject codepoints above 0x10FFFF
These are invalid because the Unicode standard says so (because UTF-16 as specified today cannot encode them).
Diffstat (limited to 'Source')
-rw-r--r--Source/cm_utf8.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cm_utf8.c b/Source/cm_utf8.c
index 2459c02..d41d097 100644
--- a/Source/cm_utf8.c
+++ b/Source/cm_utf8.c
@@ -76,6 +76,11 @@ const char* cm_utf8_decode_character(const char* first, const char* last,
return 0;
}
+ /* Invalid codepoints. */
+ if (0x10FFFF < uc) {
+ return 0;
+ }
+
*pc = uc;
return first;
}