summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c')
-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);