aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-10-09 22:00:36 +0000
committerDave Love2002-10-09 22:00:36 +0000
commit72fe130161b775ba9bfc38bd9fb2f415d98a7ea7 (patch)
tree02248734903b13a8404804b5cbbfc62fa53b8283
parentc3c8dc5222e0e774f69e1c049cbaa9b68bfde72c (diff)
downloademacs-72fe130161b775ba9bfc38bd9fb2f415d98a7ea7.tar.gz
emacs-72fe130161b775ba9bfc38bd9fb2f415d98a7ea7.zip
(decode_coding_utf_8): Treat surrogates as invalid.
-rw-r--r--src/coding.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/coding.c b/src/coding.c
index c300ce20961..7660fc01919 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1087,7 +1087,6 @@ detect_coding_utf_8 (coding, mask)
1087} 1087}
1088 1088
1089 1089
1090/* Fixme: deal with surrogates? */
1091static void 1090static void
1092decode_coding_utf_8 (coding) 1091decode_coding_utf_8 (coding)
1093 struct coding_system *coding; 1092 struct coding_system *coding;
@@ -1153,7 +1152,8 @@ decode_coding_utf_8 (coding)
1153 { 1152 {
1154 c = (((c1 & 0xF) << 12) 1153 c = (((c1 & 0xF) << 12)
1155 | ((c2 & 0x3F) << 6) | (c3 & 0x3F)); 1154 | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
1156 if (c < 0x800) 1155 if (c < 0x800
1156 || (c >= 0xd800 && c < 0xe000)) /* surrogates (invalid) */
1157 goto invalid_code; 1157 goto invalid_code;
1158 } 1158 }
1159 else 1159 else