From 92ead6c55d0202083b2b57833b74ce5a5dfb5d91 Mon Sep 17 00:00:00 2001
From: Takuji Tanaka <KXD02663@nifty.ne.jp>
Date: Sun, 6 May 2018 11:16:15 +0000
Subject: [PATCH 7/7] ptexdir: More strict check kanji token

git-svn-id: svn://tug.org/texlive/trunk/Build/source@47626 c570f23f-e606-0410-a88d-b1316a301751
---
 texk/web2c/ptexdir/ChangeLog | 4 ++++
 texk/web2c/ptexdir/kanji.c   | 4 +++-
 texk/web2c/uptexdir/kanji.c  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/texk/web2c/ptexdir/ChangeLog b/texk/web2c/ptexdir/ChangeLog
index cc07b4c33..a754ccc6f 100644
--- a/texk/web2c/ptexdir/ChangeLog
+++ b/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,7 @@
+2018-05-06  Hironori Kitagawa  <h_kitagawa2001@yahoo.co.jp>
+
+	* kanji.c: More strict check kanji token.
+
 2018-04-14  Hironori Kitagawa  <h_kitagawa2001@yahoo.co.jp>
 
 	* ptex-base.ch: Fix issue GitHub:texjporg/tex-jp-build#57
diff --git a/texk/web2c/ptexdir/kanji.c b/texk/web2c/ptexdir/kanji.c
index d7e5a3f26..5cd9ebabe 100644
--- a/texk/web2c/ptexdir/kanji.c
+++ b/texk/web2c/ptexdir/kanji.c
@@ -4,6 +4,7 @@
  */
 
 #include "kanji.h"
+#define CS_TOKEN_FLAG   0xFFFF
 
 #if !defined(WIN32)
 int sjisterminal;
@@ -12,7 +13,8 @@ int sjisterminal;
 /* TOKEN */
 boolean check_kanji(integer c)
 {
-    return is_char_kanji(c);
+    if (c >= CS_TOKEN_FLAG) return false;
+    else return is_char_kanji(c);
 }
 
 boolean is_char_ascii(integer c)
diff --git a/texk/web2c/uptexdir/kanji.c b/texk/web2c/uptexdir/kanji.c
index 70c2e21a2..dcb202089 100644
--- a/texk/web2c/uptexdir/kanji.c
+++ b/texk/web2c/uptexdir/kanji.c
@@ -18,7 +18,7 @@ int sjisterminal;
 /* TOKEN */
 boolean check_kanji (integer c)
 {
-    if (c > CS_TOKEN_FLAG) return false;
+    if (c >= CS_TOKEN_FLAG) return false;
     else if (!(XXHi(c)>=KCAT_KANJI && XXHi(c)<=KCAT_HANGUL)) return false;
     else return is_char_kanji(c);
 }
-- 
2.17.0

