# HG changeset patch # User Dave Love # Date 1034200836 0 # Node ID 88a9e962e183731d8068b9cf16b1aa00ff54f149 # Parent 676dae22b5b10f0975f983aff786c51a07c1e973 (decode_coding_utf_8): Treat surrogates as invalid. diff -r 676dae22b5b1 -r 88a9e962e183 src/coding.c --- 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