changeset 89184:88a9e962e183

(decode_coding_utf_8): Treat surrogates as invalid.
author Dave Love <fx@gnu.org>
date Wed, 09 Oct 2002 22:00:36 +0000
parents 676dae22b5b1
children a36316c7294b
files src/coding.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Wed Oct 09 06:14:14 2002 +0000
+++ b/src/coding.c	Wed Oct 09 22:00:36 2002 +0000
@@ -1087,7 +1087,6 @@
 }
 
 
-/* Fixme: deal with surrogates?  */
 static void
 decode_coding_utf_8 (coding)
      struct coding_system *coding;
@@ -1153,7 +1152,8 @@
 		{
 		  c = (((c1 & 0xF) << 12)
 		       | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
-		  if (c < 0x800)
+		  if (c < 0x800
+		      || (c >= 0xd800 && c < 0xe000)) /* surrogates (invalid) */
 		    goto invalid_code;
 		}
 	      else