texlive[68680] Build/source/texk/web2c/pdftexdir: apply fix from

commits+karl at tug.org commits+karl at tug.org
Fri Oct 27 23:31:34 CEST 2023


Revision: 68680
          https://tug.org/svn/texlive?view=revision&revision=68680
Author:   karl
Date:     2023-10-27 23:31:34 +0200 (Fri, 27 Oct 2023)
Log Message:
-----------
apply fix from thanh (pdftex r912) for text extraction on BigEndian

Revision Links:
--------------
    https://tug.org/svn/texlive?view=revision&revision=912

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/tounicode.c

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2023-10-27 20:48:57 UTC (rev 68679)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2023-10-27 21:31:34 UTC (rev 68680)
@@ -1,3 +1,10 @@
+2023-10-27  Thanh Han The  <hanthethanh at 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 at freefriends.org>
 
 	* ptexmac.h (cmp_return): a few words of documentation about

Modified: trunk/Build/source/texk/web2c/pdftexdir/tounicode.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/tounicode.c	2023-10-27 20:48:57 UTC (rev 68679)
+++ trunk/Build/source/texk/web2c/pdftexdir/tounicode.c	2023-10-27 21:31:34 UTC (rev 68680)
@@ -66,6 +66,7 @@
     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 @@
         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);



More information about the tex-live-commits mailing list.