From c45afdc843154fcb09b583f54a2f802c6069b50e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 27 Oct 2023 21:31:34 +0000 Subject: 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 --- Build/source/texk/web2c/pdftexdir/ChangeLog | 7 +++++++ Build/source/texk/web2c/pdftexdir/tounicode.c | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Build/source') 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 + + * 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 * 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); -- cgit v1.2.3