From 99107004b1126160d8dc69df59af03dfb62d2f54 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sat, 20 Jul 2013 13:19:05 +0900 Subject: [PATCH] * coding.c (CODING_ISO_FLAG_LEVEL_4): New macro. (decode_coding_iso_2022): Check the single-shift area. (Bug#8522) --- lisp/ChangeLog | 5 +++++ src/ChangeLog | 5 +++++ src/coding.c | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fc38ef046a..ccc27f71ac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-07-20 Kenichi Handa + + * international/mule.el (coding-system-iso-2022-flags): Add + `level-4'. (Bug#8522) + 2013-07-18 Michael Albinus * filenotify.el (file-notify--library): Renamed from diff --git a/src/ChangeLog b/src/ChangeLog index 8a1c163998..c3a9ee4c14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-07-20 Kenichi Handa + + * coding.c (CODING_ISO_FLAG_LEVEL_4): New macro. + (decode_coding_iso_2022): Check the single-shift area. (Bug#8522) + 2013-07-18 Paul Eggert * filelock.c: Fix unlikely file descriptor leaks. diff --git a/src/coding.c b/src/coding.c index e779197bbd..ad2042672b 100644 --- a/src/coding.c +++ b/src/coding.c @@ -493,6 +493,8 @@ enum iso_code_class_type #define CODING_ISO_FLAG_USE_OLDJIS 0x10000 +#define CODING_ISO_FLAG_LEVEL_4 0x20000 + #define CODING_ISO_FLAG_FULL_SUPPORT 0x100000 /* A character to be produced on output if encoding of the original @@ -3733,7 +3735,9 @@ decode_coding_iso_2022 (struct coding_system *coding) else charset = CHARSET_FROM_ID (charset_id_2); ONE_MORE_BYTE (c1); - if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0)) + if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0) + || ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_LEVEL_4) + ? c1 >= 0x80 : c1 < 0x80)) goto invalid_code; break; @@ -3747,7 +3751,9 @@ decode_coding_iso_2022 (struct coding_system *coding) else charset = CHARSET_FROM_ID (charset_id_3); ONE_MORE_BYTE (c1); - if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0)) + if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0) + || ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_LEVEL_4) + ? c1 >= 0x80 : c1 < 0x80)) goto invalid_code; break; -- 2.20.1