From 72fe130161b775ba9bfc38bd9fb2f415d98a7ea7 Mon Sep 17 00:00:00 2001 From: Dave Love Date: Wed, 9 Oct 2002 22:00:36 +0000 Subject: [PATCH] (decode_coding_utf_8): Treat surrogates as invalid. --- src/coding.c | 4 ++-- 1 file 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) } -/* Fixme: deal with surrogates? */ static void decode_coding_utf_8 (coding) struct coding_system *coding; @@ -1153,7 +1152,8 @@ decode_coding_utf_8 (coding) { 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 -- 2.39.2