summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-10-27 21:31:34 +0000
committerKarl Berry <karl@freefriends.org>2023-10-27 21:31:34 +0000
commitc45afdc843154fcb09b583f54a2f802c6069b50e (patch)
tree0f63e1c15431a9c749d2d1104a8184c4f4d6ceb9
parent3bab6284c93491b38391f3f71cc7113c1fdb5038 (diff)
apply fix from thanh (pdftex r912) for text extraction on BigEndian
git-svn-id: svn://tug.org/texlive/trunk@68680 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/pdftexdir/tounicode.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index 6dfdcabd841..6c029435f37 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,10 @@
+2023-10-27 Thanh Han The <hanthethanh@gmail.com>
+
+ * tounicode.c (deftounicode): sscanf %lX into unsigned long to
+ avoid failure in text extraction on BigEndian systems. Report
+ from hille42,
+ https://tug.org/pipermail/pdftex/2023-October/009342.html.
+
2023-09-01 Karl Berry <karl@freefriends.org>
* ptexmac.h (cmp_return): a few words of documentation about
diff --git a/Build/source/texk/web2c/pdftexdir/tounicode.c b/Build/source/texk/web2c/pdftexdir/tounicode.c
index e57c36f6be4..2fc4a99764a 100644
--- a/Build/source/texk/web2c/pdftexdir/tounicode.c
+++ b/Build/source/texk/web2c/pdftexdir/tounicode.c
@@ -66,6 +66,7 @@ void deftounicode(strnumber glyph, strnumber unistr)
int i, l;
glyph_unicode_entry *gu, t;
void **aa;
+ unsigned long sscan_result;
p = makecstring(glyph);
assert(strlen(p) < SMALL_BUF_SIZE);
@@ -115,13 +116,15 @@ void deftounicode(strnumber glyph, strnumber unistr)
gu->code = UNI_STRING;
gu->unicode_seq = xstrdup(buf2);
} else {
- i = sscanf(p, "%lX", &(gu->code));
+ i = sscanf(p, "%lX", &sscan_result);
assert(i == 1);
- if (gu->code < 0 || gu->code > 0x10FFFF) {
+ if (sscan_result > 0x10FFFF) {
pdftex_warn("ToUnicode: value out of range [0,10FFFF]: %lX",
- gu->code);
+ sscan_result);
gu->code = UNI_UNDEF;
}
+ else
+ gu->code = sscan_result;
}
aa = avl_probe(glyph_unicode_tree, gu);
assert(aa != NULL);