summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-11-07 21:40:53 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-11-07 21:40:53 +0000
commit2f29d391e221968fa9587130e45fb5c914fbf8ae (patch)
treef019a8930113338a532e4c82a4acab6ec426a385
parent828da7b5f86a43b1ab9f31afeab0a23bd8e84fe9 (diff)
XeTeX_ext.c: Sync with the upstream. Guard against out-of-range result from UTF-8 decoding, and return U+FFFD Replacement Character instead.
git-svn-id: svn://tug.org/texlive/trunk@45714 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog
index 3e8fec002fc..8cfc5544af1 100644
--- a/Build/source/texk/web2c/xetexdir/ChangeLog
+++ b/Build/source/texk/web2c/xetexdir/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-07 Jonathan Kew <jfkthame@gmail.com>
+
+ * XeTeX_ext.c: Guard against out-of-range result from UTF-8
+ decoding, and return U+FFFD Replacement Character instead
+ to avoid a crash for invalid inputs (from A. Kakuto).
+
2017-09-24 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
* xetex.web: Avoid overwriting prim_* entries by primitive().
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 533423bf052..fa83bab8289 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -2786,6 +2786,10 @@ get_uni_c(UFILE* f)
return 0xfffd; /* return without adjusting by offsetsFromUTF8 */
};
rval -= offsetsFromUTF8[extraBytes];
+ if (rval < 0 || rval > 0x10ffff) {
+ badutf8warning();
+ return 0xfffd;
+ }
}
break;