From be7526d00a4c2609238324372cbe6400ff0f9640 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Fri, 25 Aug 2006 22:25:55 +0300 Subject: [PATCH] terminal UTF-8: Reject code points reserved for UTF-16 surrogates. Those code points are allowed in CESU-8 but not in UTF-8. --- src/terminal/event.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/terminal/event.c b/src/terminal/event.c index 08098ff0..55931789 100644 --- a/src/terminal/event.c +++ b/src/terminal/event.c @@ -337,7 +337,10 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev) if (! --interlink->utf_8.len) { unicode_val_T u = interlink->utf_8.ucs; - if (u < interlink->utf_8.min) + /* UTF-8 allows neither overlong + * sequences nor surrogates. */ + if (u < interlink->utf_8.min + || is_utf16_surrogate(u)) u = UCS_REPLACEMENT_CHARACTER; term_send_ucs(term, u, term->interlink->utf_8.modifier); -- 2.11.4.GIT