texlive[74917] branches/branch2025/Build/source/texk/dvipdfm-x: sync
commits+karl at tug.org
commits+karl at tug.org
Sat Apr 12 18:16:15 CEST 2025
Revision: 74917
https://tug.org/svn/texlive?view=revision&revision=74917
Author: karl
Date: 2025-04-12 18:16:14 +0200 (Sat, 12 Apr 2025)
Log Message:
-----------
sync dvipdfmx on 2025 branch from r74909, for crash fixes et al.
Revision Links:
--------------
https://tug.org/svn/texlive?view=revision&revision=74909
Modified Paths:
--------------
branches/branch2025/Build/source/texk/dvipdfm-x/ChangeLog
branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.am
branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.in
branches/branch2025/Build/source/texk/dvipdfm-x/configure
branches/branch2025/Build/source/texk/dvipdfm-x/configure.ac
branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.c
branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.h
branches/branch2025/Build/source/texk/dvipdfm-x/epdf.c
branches/branch2025/Build/source/texk/dvipdfm-x/pdffont.c
branches/branch2025/Build/source/texk/dvipdfm-x/pdfobj.c
branches/branch2025/Build/source/texk/dvipdfm-x/vf.c
branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-psz.test
Added Paths:
-----------
branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf
branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf
branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup.tex
branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv
branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-pdf.test
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/ChangeLog 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/ChangeLog 2025-04-12 16:16:14 UTC (rev 74917)
@@ -1,3 +1,45 @@
+2025-04-10 Karl Berry <karl at freefriends.org>
+
+ * configure.ac: version 20250410.
+
+2025-04-09 Karl Berry <karl at freefriends.org>
+
+ * pdfobj.c (pdf_get_object): fix possible seg fault in
+ object stream parsing. Report and patch from Shuqiao Zhang:
+ https://tug.org/pipermail/tex-live/2025-April/051444.html
+
+ * xdvipdfm-pdf.test: new test, for this (pdfobj) and the page
+ Group (pdfgroup) fix from Clerk ma.
+ * Makefile.am (tests): add it.
+ * tests/xdvipdfm-pdfobj.xdv,
+ * tests/xdvipdfm-pdfgroup.dvi: new test input files.
+ * tests/rpki-ecosystem.drawio.pdf,
+ * tests/xdvipdfm-pdfgroup-0318.pdf: inclusion files for the tests.
+
+2025-03-17 Clerk Ma <clerkma at gmail.com>
+
+ * epdf.c (pdf_include_page): check for the page Group being NULL
+ before dereferencing it. (r74687)
+
+2025-03-17 TANAKA Takuji <ttk at t-lab.opal.ne.jp>
+
+ * vf.c: Store combining characters in vitual fonts with indices
+ and save memories to fix issue reported by gbb 60166.
+ https://okumuralab.org/tex/mod/forum/discuss.php?d=3903
+ * configure.ac: version 20250317.
+
+2025-03-14 Max Chernoff <tex at maxchernoff.ca>
+
+ * pdffont.c: Switch to using only A-Z in the tag since numerical
+ digits are invalid per the PDF spec. Thanks to Yukimasa Morimi,
+ https://tug.org/pipermail/dvipdfmx/2025-March/000370.html
+
+2025-03-13 Max Chernoff <tex at maxchernoff.ca>
+
+ * dvipdfmx.c, dvipdfmx.h, pdffont.c: Use deterministic font names.
+ Report from Paulo Ney de Souza,
+ https://tug.org/pipermail/dvipdfmx/2025-March/000353.html
+
2025-03-07 Karl Berry <karl at tug.org>
* TL'25 release.
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.am
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.am 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.am 2025-04-12 16:16:14 UTC (rev 74917)
@@ -1,7 +1,7 @@
## $Id$
## Makefile.am for the TeX Live subdirectory texk/dvipdfm-x/
##
-## Copyright 2015-2024 Karl Berry <tex-live at tug.org>
+## Copyright 2015-2025 Karl Berry <tex-live at tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live at tug.org>
## You may freely use, modify and/or distribute this file.
##
@@ -243,13 +243,15 @@
## Tests
##
TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test xdvipdfm-bb.test
-TESTS += xdvipdfm-bkm.test xdvipdfm-psz.test xdvipdfm-ptx.test xdvipdfm-res.test
+TESTS += xdvipdfm-bkm.test xdvipdfm-pdf.test xdvipdfm-psz.test
+TESTS += xdvipdfm-ptx.test xdvipdfm-res.test
TESTS += xdvipdfm-rev.test xdvipdfm-ttc.test
TESTS += dvipdfmx-upjf.test dvipdfmx-upjf2.test dvipdfmx-upjf3.test dvipdfmx-incl.test
TESTS += dvipdfmx-lmr0.test dvipdfmx-lmr1.test
TESTS += dvipdfmx-ttf0.test
xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
- xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
+ xdvipdfm-bkm.log xdvipdfm-pdf.log xdvipdfm-psz.log \
+ xdvipdfm-ptx.log xdvipdfm-res.log \
xdvipdfm-rev.log xdvipdfm-ttc.log \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-upjf3.log dvipdfmx-incl.log \
dvipdfmx-lmr0.log dvipdfmx-lmr1.log \
@@ -279,6 +281,9 @@
## xdvipdfm-bkm.test
EXTRA_DIST += tests/bookm.dvi tests/bookm.tex
DISTCLEANFILES += bookm*.pdf
+## xdvipdfm-pdf.test
+EXTRA_DIST += tests/xdvipdfm-pdf.xdv tests/rpki-ecosystem.drawio.pdf
+DISTCLEANFILES += xdvipdfm-pdf*.pdf
## xdvipdfm-psz.test
EXTRA_DIST += tests/paper.dvi tests/paper.tex
DISTCLEANFILES += paper*.pdf
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.in
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.in 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/Makefile.in 2025-04-12 16:16:14 UTC (rev 74917)
@@ -828,16 +828,16 @@
cmapdatadir = $(datarootdir)/texmf-dist/fonts/cmap/dvipdfmx
dist_cmapdata_DATA = data/EUC-UCS2
DISTCLEANFILES = config.force image*.pdf xbmc*.pdf annot*.pdf pic*.* \
- bookm*.pdf paper*.pdf ptex*.pdf resrc*.pdf reverse.pdf \
- ttc*.pdf upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm upjf-*.tfm \
- upjf_*.pdf upjf1_*.pdf upjf2_*.pdf upjf3_*.pdf multi_incl.pdf \
- lmr0-*.pdf cprm*.pdf
+ bookm*.pdf xdvipdfm-pdf*.pdf paper*.pdf ptex*.pdf resrc*.pdf \
+ reverse.pdf ttc*.pdf upjf.vf upjv.vf upjf-*.ofm upjv-*.ofm \
+ upjf-*.tfm upjf_*.pdf upjf1_*.pdf upjf2_*.pdf upjf3_*.pdf \
+ multi_incl.pdf lmr0-*.pdf cprm*.pdf
TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test \
- xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test \
- xdvipdfm-ptx.test xdvipdfm-res.test xdvipdfm-rev.test \
- xdvipdfm-ttc.test dvipdfmx-upjf.test dvipdfmx-upjf2.test \
- dvipdfmx-upjf3.test dvipdfmx-incl.test dvipdfmx-lmr0.test \
- dvipdfmx-lmr1.test dvipdfmx-ttf0.test
+ xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-pdf.test \
+ xdvipdfm-psz.test xdvipdfm-ptx.test xdvipdfm-res.test \
+ xdvipdfm-rev.test xdvipdfm-ttc.test dvipdfmx-upjf.test \
+ dvipdfmx-upjf2.test dvipdfmx-upjf3.test dvipdfmx-incl.test \
+ dvipdfmx-lmr0.test dvipdfmx-lmr1.test dvipdfmx-ttf0.test
EXTRA_DIST = $(TESTS) tests/dvipdfmx.cfg tests/psfonts.map \
tests/cmr10.pfb tests/cmr10.tfm tests/image.dvi \
tests/image.tex tests/xbmc.dvi tests/xbmc.tex \
@@ -851,6 +851,7 @@
tests/picjpeg.xbb tests/image.png tests/picpng.bb \
tests/picpng.xbb tests/image.pdf tests/picpdf.bb \
tests/picpdf.xbb tests/bookm.dvi tests/bookm.tex \
+ tests/xdvipdfm-pdf.xdv tests/rpki-ecosystem.drawio.pdf \
tests/paper.dvi tests/paper.tex tests/ptex.dvi tests/resrc.dvi \
tests/resrc.tex tests/reverse.dvi tests/ttc.dvi tests/ttc.tex \
tests/test.ttc tests/upjf.dvi tests/upjf.tex tests/upjf.map \
@@ -2056,7 +2057,8 @@
@ZLIB_RULE@
@LIBPAPER_RULE@
xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
- xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
+ xdvipdfm-bkm.log xdvipdfm-pdf.log xdvipdfm-psz.log \
+ xdvipdfm-ptx.log xdvipdfm-res.log \
xdvipdfm-rev.log xdvipdfm-ttc.log \
dvipdfmx-upjf.log dvipdfmx-upjf2.log dvipdfmx-upjf3.log dvipdfmx-incl.log \
dvipdfmx-lmr0.log dvipdfmx-lmr1.log \
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/configure
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/configure 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/configure 2025-04-12 16:16:14 UTC (rev 74917)
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20250205.
+# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20250410.
#
# Report bugs to <dvipdfmx at tug.org>.
#
@@ -614,8 +614,8 @@
# Identity of this package.
PACKAGE_NAME='dvipdfm-x (TeX Live)'
PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20250205'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20250205'
+PACKAGE_VERSION='20250410'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20250410'
PACKAGE_BUGREPORT='dvipdfmx at tug.org'
PACKAGE_URL=''
@@ -1387,7 +1387,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-'configure' configures dvipdfm-x (TeX Live) 20250205 to adapt to many kinds of systems.
+'configure' configures dvipdfm-x (TeX Live) 20250410 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1459,7 +1459,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20250205:";;
+ short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20250410:";;
esac
cat <<\_ACEOF
@@ -1590,7 +1590,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dvipdfm-x (TeX Live) configure 20250205
+dvipdfm-x (TeX Live) configure 20250410
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2371,7 +2371,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dvipdfm-x (TeX Live) $as_me 20250205, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20250410, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -9263,7 +9263,7 @@
# Define the identity of the package.
PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20250205'
+ VERSION='20250410'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -16931,7 +16931,7 @@
Report bugs to <bug-libtool at gnu.org>."
lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20250205
+dvipdfm-x (TeX Live) config.lt 20250410
configured by $0, generated by GNU Autoconf 2.72.
Copyright (C) 2024 Free Software Foundation, Inc.
@@ -18885,7 +18885,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dvipdfm-x (TeX Live) $as_me 20250205, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20250410, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18957,7 +18957,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-dvipdfm-x (TeX Live) config.status 20250205
+dvipdfm-x (TeX Live) config.status 20250410
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/configure.ac
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/configure.ac 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/configure.ac 2025-04-12 16:16:14 UTC (rev 74917)
@@ -8,7 +8,7 @@
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-AC_INIT([dvipdfm-x (TeX Live)], [20250205], [dvipdfmx at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20250410], [dvipdfmx at tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([agl.c])
AC_CONFIG_AUX_DIR([../../build-aux])
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.c
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.c 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.c 2025-04-12 16:16:14 UTC (rev 74917)
@@ -127,7 +127,7 @@
static int has_paper_option = 0;
/* Input and output filenames */
-static char *dvi_filename = NULL, *pdf_filename = NULL;
+char *dvi_filename = NULL, *pdf_filename = NULL;
static void read_config_file (const char *config);
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.h
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.h 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/dvipdfmx.h 2025-04-12 16:16:14 UTC (rev 74917)
@@ -26,6 +26,7 @@
#define _DVIPDFMX_H_
extern const char *my_name;
+extern char *dvi_filename, *pdf_filename;
extern int extractbb(int argc, char *argv[]);
extern void read_config_special(const char **start, const char *end);
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/epdf.c
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/epdf.c 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/epdf.c 2025-04-12 16:16:14 UTC (rev 74917)
@@ -119,7 +119,7 @@
xform_info info;
pdf_obj *contents = NULL, *catalog;
pdf_obj *page = NULL, *resources = NULL, *markinfo = NULL;
- pdf_obj *group = NULL;
+ pdf_obj *group = NULL, *group_obj = NULL;
pf = pdf_open(ident, image_file);
if (!pf)
@@ -155,7 +155,9 @@
/*
* Handle page's Group
*/
- group = pdf_deref_obj(pdf_lookup_dict(page, "Group"));
+ group_obj = pdf_lookup_dict(page, "Group");
+ if (group_obj)
+ group = pdf_import_object(group_obj);
/*
* Handle page content stream.
*/
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/pdffont.c
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/pdffont.c 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/pdffont.c 2025-04-12 16:16:14 UTC (rev 74917)
@@ -31,6 +31,7 @@
#include "mem.h"
#include "dpxconf.h"
+#include "dpxcrypt.h"
#include "dpxfile.h"
#include "dpxutil.h"
@@ -51,6 +52,8 @@
#include "type0.h"
#include "tt_cmap.h"
+#include "dvipdfmx.h"
+
#include "pdffont.h"
#define MREC_HAS_TOUNICODE(m) ((m) && (m)->opt.tounicode)
@@ -61,14 +64,68 @@
PKFont_set_dpi(font_dpi);
}
+static union {
+ char p[sizeof(int)];
+ int* i;
+} unique_tag_count;
+
+/* This function used to be implemented as
+ *
+ * for (i = 0; i < 6; i++) {
+ * ch = rand() % 26;
+ * tag[i] = ch + 'A';
+ * }
+ * tag[6] = '\0';
+ *
+ * but this meant that the tag would change on every run, producing a
+ * non-deterministic PDF file. You could work around this by setting
+ * `SOURCE_DATE_EPOCH` in the environment (since the current time is used to
+ * seed `rand`), but that requires extra effort. Instead, we use an MD5 hash of
+ * the input (dvi) filename, the output (pdf) filename, and a counter that
+ * increments on each call to this function. This produces a deterministic tag
+ * for each document, provided that the input filename, the output filename, and
+ * the order/number of fonts remains the same.
+ *
+ * Why do we need this function in the first place? Well, since we are
+ * subsetting the fonts, this means that the "LM Roman 10" font in one document
+ * will not be the same as the "LM Roman 10" font in another document. This can
+ * cause problems when older/buggy PDF processors merge or embed multiple
+ * documents, since it's invalid to have two fonts with the same name and
+ * neither font is a strict subset/superset of the other.
+ *
+ * pdfTeX and LuaTeX solve this by hashing over the subsetting hash table, but
+ * this only works there since they only generate the PDF font name _after_
+ * creating the subset. (x)dvipdfmx generates the PDF font name as (almost) the
+ * very first step when including a font, so we couldn't use this method without
+ * extensive refactoring.
+ *
+ * The pdfTeX and LuaTeX methods guarantee that multiple incompatible subsets
+ * will never have the same name (barring hash collisions), and the prior `rand`
+ * method had the same guarantee (barring an _extremely_ unlikely RNG
+ * collision). This new method isn't quite as good since if the input and output
+ * are both pipes, then both filenames will be `NULL` and the tag will only
+ * depend on the counter. But I think that most PDF processors these days will
+ * properly check for font name collisions, so this is probably good enough.
+ */
void
pdf_font_make_uniqueTag (char *tag)
{
- int i;
- char ch;
+ MD5_CONTEXT state;
+ unsigned char digest[16];
+ int i, ch;
+ unique_tag_count.i++;
+
+ MD5_init(&state);
+ if (dvi_filename)
+ MD5_write(&state, dvi_filename, strlen(dvi_filename));
+ if (pdf_filename)
+ MD5_write(&state, pdf_filename, strlen(pdf_filename));
+ MD5_write(&state, unique_tag_count.p, sizeof(unique_tag_count));
+ MD5_final(digest, &state);
+
for (i = 0; i < 6; i++) {
- ch = rand() % 26;
+ ch = digest[i] % 26;
tag[i] = ch + 'A';
}
tag[6] = '\0';
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/pdfobj.c
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/pdfobj.c 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/pdfobj.c 2025-04-12 16:16:14 UTC (rev 74917)
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2002-2025 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -3646,7 +3646,8 @@
length = pdf_stream_length(objstm);
p = (const char *) pdf_stream_dataptr(objstm) + first + data[2*index+1];
- q = p + (index == n-1 ? length : first+data[2*index+3]);
+ q = (const char *) pdf_stream_dataptr(objstm)
+ + (index == n-1 ? length : first+data[2*index+3]);
result = parse_pdf_object(&p, q, pf);
if (!result)
goto error;
Added: branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf
===================================================================
(Binary files differ)
Index: branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf 2025-04-12 16:16:14 UTC (rev 74917)
Property changes on: branches/branch2025/Build/source/texk/dvipdfm-x/tests/rpki-ecosystem.drawio.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf
===================================================================
(Binary files differ)
Index: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf 2025-04-12 16:16:14 UTC (rev 74917)
Property changes on: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup-0318.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup.tex
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup.tex (rev 0)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup.tex 2025-04-12 16:16:14 UTC (rev 74917)
@@ -0,0 +1,8 @@
+% $Id: xdvipdfm-pdfgroup.tex 74908 2025-04-10 22:20:35Z karl $
+% Public domain. Test input file for xdvipdfm-pdf(group) test.
+% latex, dvipdfmx
+\documentclass[dvipdfmx]{article}
+\usepackage{graphicx}
+\begin{document}
+\includegraphics[width=4cm]{xdvipdfm-pdfgroup-0318.pdf}
+\end{document}
Property changes on: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfgroup.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv
===================================================================
(Binary files differ)
Index: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv 2025-04-12 16:16:14 UTC (rev 74917)
Property changes on: branches/branch2025/Build/source/texk/dvipdfm-x/tests/xdvipdfm-pdfobj.xdv
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/vf.c
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/vf.c 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/vf.c 2025-04-12 16:16:14 UTC (rev 74917)
@@ -47,6 +47,8 @@
#define TEXPT2PT (72.0/72.27)
#define FW2PT (TEXPT2PT/((double)(FIX_WORD_BASE)))
+#define CHAR_INDEX_MIN 0x40000
+
struct font_def {
int32_t font_id /* id used internally in vf file */;
uint32_t checksum, size, design_size;
@@ -65,6 +67,7 @@
unsigned char **ch_pkt, message_flag;
uint32_t *pkt_len;
unsigned num_chars;
+ uint32_t *idx_to_char, max_idx;
};
struct vf *vf_fonts = NULL;
@@ -111,12 +114,21 @@
{
unsigned i;
if (size > (a_vf->num_chars)) {
- size = MAX (size, a_vf->num_chars+256);
+ if (size > 0x40000)
+ size = MAX (size+0x1000, a_vf->num_chars+0x40000);
+ else if (size > 0x8000)
+ size = MAX (size+0x1000, a_vf->num_chars+0x8000);
+ else if (size > 0x1000)
+ size = MAX (size+0x100, a_vf->num_chars+0x1000);
+ else
+ size = MAX (size, a_vf->num_chars+256);
a_vf->ch_pkt = RENEW (a_vf->ch_pkt, size, unsigned char *);
a_vf->pkt_len = RENEW (a_vf->pkt_len, size, uint32_t);
+ a_vf->idx_to_char = RENEW (a_vf->idx_to_char, size, uint32_t);
for (i=a_vf->num_chars; i<size; i++) {
(a_vf->ch_pkt)[i] = NULL;
(a_vf->pkt_len)[i] = 0;
+ (a_vf->idx_to_char)[i] = -1;
}
a_vf->num_chars = size;
}
@@ -126,20 +138,35 @@
uint32_t ch)
{
unsigned char *pkt;
+ uint32_t idx;
+
#ifdef DEBUG
fprintf (stderr, "read_a_char_def: len=%u, ch=%u\n", pkt_len, ch);
#endif
+ idx = ch;
+ if (ch >= CHAR_INDEX_MIN) {
+ if (vf_fonts[thisfont].max_idx==0)
+ vf_fonts[thisfont].max_idx = CHAR_INDEX_MIN;
+ idx = vf_fonts[thisfont].max_idx;
+ }
/* Resize and initialize character arrays if necessary */
- if (ch >= vf_fonts[thisfont].num_chars) {
- resize_one_vf_font (vf_fonts+thisfont, ch+1);
+ if (idx >= vf_fonts[thisfont].num_chars)
+ resize_one_vf_font (vf_fonts+thisfont, idx+1);
+ if (ch >= CHAR_INDEX_MIN) {
+ if (idx > CHAR_INDEX_MIN && (vf_fonts[thisfont].idx_to_char)[idx-1] >= ch) {
+ fprintf (stderr, "Unexpected character code: %x, index: %x\n", ch, idx);
+ ERROR ("Unexpected character code in vf file\n");
+ }
+ (vf_fonts[thisfont].idx_to_char)[idx] = ch;
+ vf_fonts[thisfont].max_idx++;
}
if (pkt_len > 0) {
pkt = NEW (pkt_len, unsigned char);
if (fread (pkt, 1, pkt_len, vf_file) != pkt_len)
ERROR ("VF file ended prematurely.");
- (vf_fonts[thisfont].ch_pkt)[ch] = pkt;
+ (vf_fonts[thisfont].ch_pkt)[idx] = pkt;
}
- (vf_fonts[thisfont].pkt_len)[ch] = pkt_len;
+ (vf_fonts[thisfont].pkt_len)[idx] = pkt_len;
return;
}
@@ -278,6 +305,8 @@
vf_fonts[thisfont].num_chars = 0;
vf_fonts[thisfont].ch_pkt = NULL;
vf_fonts[thisfont].pkt_len = NULL;
+ vf_fonts[thisfont].idx_to_char = NULL;
+ vf_fonts[thisfont].max_idx = 0;
}
read_header(vf_file, thisfont);
process_vf_file (vf_file, thisfont);
@@ -406,6 +435,20 @@
unsigned char *start, *end;
spt_t ptsize;
int default_font = -1;
+ int32_t idx;
+ idx = ch;
+ if (ch >= CHAR_INDEX_MIN) {
+ int32_t j, k, mid, ch0;
+ idx = -1;
+ j=CHAR_INDEX_MIN; k=vf_fonts[vf_font].max_idx;
+ while (j < k) {
+ mid = j + (k - j) / 2;
+ ch0 = (vf_fonts[vf_font].idx_to_char)[mid];
+ if (ch0 < ch) j = mid+1;
+ else if (ch0 > ch) k = mid;
+ else { idx = mid; break; }
+ }
+ }
if (vf_font < num_vf_fonts) {
/* Initialize to the first font or -1 if undefined */
ptsize = vf_fonts[vf_font].ptsize;
@@ -412,10 +455,10 @@
if (vf_fonts[vf_font].num_dev_fonts > 0)
default_font = ((vf_fonts[vf_font].dev_fonts)[0]).dev_id;
dvi_vf_init (default_font);
- if (ch >= vf_fonts[vf_font].num_chars ||
- !(start = (vf_fonts[vf_font].ch_pkt)[ch])) {
+ if (idx >= vf_fonts[vf_font].num_chars || idx < 0 ||
+ !(start = (vf_fonts[vf_font].ch_pkt)[idx])) {
int is_jfm = tfm_is_jfm(vf_fonts[vf_font].dev_fonts[0].tfm_id);
- if (is_jfm &&
+ if (is_jfm && ch < CHAR_INDEX_MIN &&
ch <= JFM_LASTCHAR && dpx_conf.compat_mode != dpx_mode_xdv_mode) {
/* fallback multibyte character for (u)pTeX */
if (dpx_conf.verbose_level == 1)
@@ -437,7 +480,7 @@
fprintf (stderr, "Tried to set a nonexistent character in a virtual font");
start = end = NULL;
} else {
- end = start + (vf_fonts[vf_font].pkt_len)[ch];
+ end = start + (vf_fonts[vf_font].pkt_len)[idx];
}
while (start && start < end) {
opcode = *(start++);
@@ -555,6 +598,8 @@
}
if (vf_fonts[i].pkt_len)
RELEASE (vf_fonts[i].pkt_len);
+ if (vf_fonts[i].idx_to_char)
+ RELEASE (vf_fonts[i].idx_to_char);
if (vf_fonts[i].tex_name)
RELEASE (vf_fonts[i].tex_name);
/* Release each font record */
Added: branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-pdf.test
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-pdf.test (rev 0)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-pdf.test 2025-04-12 16:16:14 UTC (rev 74917)
@@ -0,0 +1,54 @@
+#! /bin/sh -vx
+# $Id: xdvipdfm-pdf.test 74908 2025-04-10 22:20:35Z karl $
+# Copyright 2025 Karl Berry <tex-live at tug.org>
+# You may freely use, modify and/or distribute this file.
+# PDF parsing reports.
+
+BinDir=${BinDir:-.}
+ExeExt=${ExeExt:-}
+_xdvipdfmx=$BinDir/xdvipdfmx$ExeExt
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+# xdvipdfm-pdfobj: Object stream parsing bug. Original report from
+# Shuqiao Zhang,
+# https://tug.org/pipermail/tex-live/2025-April/051444.html
+# Unfortunately the bug is not reliably reproducible, as Zhang explains
+# in https://tug.org/pipermail/tex-live/2025-April/051447.html.
+
+# xdvipdfm-pdfgroup: Page group bug. Report and fix from Clerk Ma,
+# ca. 19 Mar 2025.
+
+for testfile in xdvipdfm-pdfobj.xdv xdvipdfm-pdfgroup.dvi; do
+ testin=$srcdir/tests/$testfile
+ testout=$testfile.pdf
+ #
+ # The pdfobj.xdv test includes a .pdf file, referenced as ./ in the
+ # .xdv, so have to copy it into the working directory.
+ cp $srcdir/tests/rpki-ecosystem.drawio.pdf . || exit 1
+ #
+ # By the way, the pdfgroup.dvi test includes the file
+ # xdvipdfm-pdfgroup-0318.pdf, but since that reference doesn't use
+ # "./", it can be found in srcdir/tests via TEXPICTS above.
+ #
+ cmd="$_xdvipdfmx $testin -o $testout"
+ echo "*** $cmd"
+ if $cmd && test -s $testout; then
+ echo "$testfile test OK"
+ else
+ failed="$failed $testfile"
+ fi
+done
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
Property changes on: branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-pdf.test
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-psz.test
===================================================================
--- branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-psz.test 2025-04-11 23:42:28 UTC (rev 74916)
+++ branches/branch2025/Build/source/texk/dvipdfm-x/xdvipdfm-psz.test 2025-04-12 16:16:14 UTC (rev 74917)
@@ -1,6 +1,6 @@
#! /bin/sh -vx
# $Id$
-# Copyright 2017 Karl Berry <tex-live at tug.org>
+# Copyright 2017-2025 Karl Berry <tex-live at tug.org>
# Copyright 2013 Peter Breitenlohner <tex-live at tug.org>
# You may freely use, modify and/or distribute this file.
@@ -18,14 +18,16 @@
failed=
-echo "*** xdvipdfmx -v -m 1.0 -o paper2.pdf <paper.dvi" && echo \
+echo "*** xdvipdfmx -v -m 1.0 -o paper2.pdf <paper.dvi" \
&& $_xdvipdfmx -v -m 1.0 -o paper2.pdf <$srcdir/tests/paper.dvi \
- && echo && echo "xdvipdfmx-paper tests OK" && echo \
+ && test -s paper2.pdf \
+ && echo "xdvipdfmx-paper tests OK" && echo \
|| failed="$failed xdvipdfmx-paper"
-echo "*** xdvipdfmx -v -m 1.4 -o - paper >paper2m.pdf" && echo \
- && $_xdvipdfmx -v -m 1.4 -o - $srcdir/tests/paper >paper2m.pdf \
- && echo && echo "xdvipdfmx-paper-mag tests OK" && echo \
+echo "*** xdvipdfmx -v -m 1.4 -o paper2m.pdf paper" \
+ && $_xdvipdfmx -v -m 1.4 -o paper2m.pdf $srcdir/tests/paper \
+ && test -s paper2m.pdf \
+ && echo "xdvipdfmx-paper-mag tests OK" && echo \
|| failed="$failed xdvipdfmx-paper-mag"
test -z "$failed" && exit 0
More information about the tex-live-commits
mailing list.