texlive[56586] Build/source/texk/dvipdfm-x: Fix a problem introduced

commits+kakuto at tug.org commits+kakuto at tug.org
Wed Oct 7 23:01:34 CEST 2020


Revision: 56586
          http://tug.org/svn/texlive?view=revision&revision=56586
Author:   kakuto
Date:     2020-10-07 23:01:34 +0200 (Wed, 07 Oct 2020)
Log Message:
-----------
Fix a problem introduced by the changes on 2020/10/03. (S. Hirata)

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/configure
    trunk/Build/source/texk/dvipdfm-x/configure.ac
    trunk/Build/source/texk/dvipdfm-x/dvi.c
    trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-10-07 20:54:17 UTC (rev 56585)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-10-07 21:01:34 UTC (rev 56586)
@@ -1,3 +1,14 @@
+2020-10-08  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
+
+	* dvi.c: Fix problems introduced by the changes on 2020/10/03.
+	Fix a possible problem of invalid access. Fix a problem that
+	non-BMP characters are not handled properly for the "unicode"
+	encoding.
+	* spc_pdfm.c: pdf:bcolor and pdf:scolor accept both fill and
+	stroke color specified at the same time. Change the behavior
+	when an indirect object is specified for pdf:pageresources.
+	* configure.ac: Version 20201008.
+
 2020-10-06  Akira Kakuto  <kakuto at w32tex.org>
 
 	* spc_dvips.c: Add an option -dALLOWPSTRANSPARENCY in

Modified: trunk/Build/source/texk/dvipdfm-x/configure
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure	2020-10-07 20:54:17 UTC (rev 56585)
+++ trunk/Build/source/texk/dvipdfm-x/configure	2020-10-07 21:01:34 UTC (rev 56586)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20201006.
+# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20201008.
 #
 # Report bugs to <dvipdfmx at tug.org>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='dvipdfm-x (TeX Live)'
 PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20201006'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20201006'
+PACKAGE_VERSION='20201008'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20201008'
 PACKAGE_BUGREPORT='dvipdfmx at tug.org'
 PACKAGE_URL=''
 
@@ -1350,7 +1350,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) 20201006 to adapt to many kinds of systems.
+\`configure' configures dvipdfm-x (TeX Live) 20201008 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1421,7 +1421,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20201006:";;
+     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20201008:";;
    esac
   cat <<\_ACEOF
 
@@ -1551,7 +1551,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dvipdfm-x (TeX Live) configure 20201006
+dvipdfm-x (TeX Live) configure 20201008
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2390,7 +2390,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 20201006, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20201008, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -8077,7 +8077,7 @@
 
 # Define the identity of the package.
  PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20201006'
+ VERSION='20201008'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14746,7 +14746,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20201006
+dvipdfm-x (TeX Live) config.lt 20201008
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -16636,7 +16636,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 20201006, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20201008, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16706,7 +16706,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-dvipdfm-x (TeX Live) config.status 20201006
+dvipdfm-x (TeX Live) config.status 20201008
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/texk/dvipdfm-x/configure.ac
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure.ac	2020-10-07 20:54:17 UTC (rev 56585)
+++ trunk/Build/source/texk/dvipdfm-x/configure.ac	2020-10-07 21:01:34 UTC (rev 56586)
@@ -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)], [20201006], [dvipdfmx at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20201008], [dvipdfmx at tug.org])
 AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR([agl.c])
 AC_CONFIG_AUX_DIR([../../build-aux])

Modified: trunk/Build/source/texk/dvipdfm-x/dvi.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvi.c	2020-10-07 20:54:17 UTC (rev 56585)
+++ trunk/Build/source/texk/dvipdfm-x/dvi.c	2020-10-07 21:01:34 UTC (rev 56586)
@@ -168,6 +168,7 @@
   float      slant;
   float      embolden;
 
+  int        is_unicode;
   int        minbytes;
   char       padbytes[4];
 } *loaded_fonts = NULL;
@@ -1041,6 +1042,7 @@
       loaded_fonts[cur_id].padbytes[2] = (mrec->opt.mapc >> 8) & 0xff; 
     }
     if (mrec->enc_name && !strcmp(mrec->enc_name, "unicode")) {
+      loaded_fonts[cur_id].is_unicode = 1;
       if (mrec->opt.mapc >= 0) {
         loaded_fonts[cur_id].padbytes[0] = (mrec->opt.mapc >> 24) & 0xff;
         loaded_fonts[cur_id].padbytes[1] = (mrec->opt.mapc >> 16) & 0xff;
@@ -1050,6 +1052,10 @@
   loaded_fonts[cur_id].minbytes = pdf_dev_font_minbytes(font_id);
   loaded_fonts[cur_id].type     = PHYSICAL;
   loaded_fonts[cur_id].font_id  = font_id;
+  if (loaded_fonts[cur_id].minbytes > 4) {
+    WARN("Input encoding requries more than 4 bytes per char... (unsupported)");
+    loaded_fonts[cur_id].minbytes = 4;
+  }
 
   if (dpx_conf.verbose_level > 0)
     MESG(">");
@@ -1106,6 +1112,10 @@
   loaded_fonts[cur_id].size     = ptsize;
   loaded_fonts[cur_id].type     = NATIVE;
   loaded_fonts[cur_id].minbytes = pdf_dev_font_minbytes(loaded_fonts[cur_id].font_id);
+  if (loaded_fonts[cur_id].minbytes > 4) {
+    WARN("Input encoding requries more than 4 bytes per char... (unsupprted)");
+    loaded_fonts[cur_id].minbytes = 4;
+  }
   RELEASE(fontmap_key);
 
   if (is_type1) {
@@ -1314,7 +1324,7 @@
   struct loaded_font *font;
   spt_t               width, height, depth;
   unsigned char       wbuf[4];
-  int                 cbytes = 1;
+  int                 n, cbytes;
 
   if (current_font < 0) {
     ERROR("No font selected!");
@@ -1340,12 +1350,11 @@
     dvi_right(width); /* Will actually move left */
 
   memcpy(wbuf, font->padbytes, 4);
-  cbytes = font->minbytes;
   switch (font->type) {
   case  PHYSICAL:
     if (ch > 65535) {
       /* FIXME: uptex specific undocumented */
-      if (tfm_is_jfm(font->tfm_id)) {
+      if (!font->is_unicode && tfm_is_jfm(font->tfm_id)) {
         wbuf[0] = (UTF32toUTF16HS(ch) >> 8) & 0xff;
         wbuf[1] =  UTF32toUTF16HS(ch)       & 0xff;
         wbuf[2] = (UTF32toUTF16LS(ch) >> 8) & 0xff;
@@ -1356,17 +1365,21 @@
         wbuf[2] = (ch >>  8) & 0xff;
         wbuf[3] =  ch        & 0xff;
       }
-      cbytes  = 4;
+      n = 4;
     } else if (ch > 255) {
       wbuf[2] = (ch >> 8) & 0xff;
       wbuf[3] =  ch       & 0xff;
+      n = 2;
     } else if (font->subfont_id >= 0) {
       uint16_t uch = lookup_sfd_record(font->subfont_id, (unsigned char) ch);
       wbuf[2] = (uch >> 8) & 0xff;
       wbuf[3] =  uch       & 0xff;
+      n = 2;
     } else {
       wbuf[3] = (unsigned char) ch;
+      n = 1;
     }
+    cbytes = font->minbytes > n ? font->minbytes : n;
     set_string(dvi_state.h, -dvi_state.v, wbuf + 4 - cbytes, cbytes, width, font->font_id);
     if (dvi_is_tracking_boxes()) {
       pdf_rect rect;
@@ -1401,7 +1414,7 @@
   struct loaded_font *font;
   spt_t               width, height, depth;
   unsigned char       wbuf[4];
-  int                 cbytes = 1;
+  int                 n, cbytes;
 
   if (current_font < 0) {
     ERROR("No font selected!");
@@ -1410,7 +1423,6 @@
   font = &loaded_fonts[current_font];
 
   memcpy(wbuf, font->padbytes, 4);
-  cbytes = font->minbytes;
   switch (font->type) {
   case  PHYSICAL:
     width = tfm_get_fw_width(font->tfm_id, ch);
@@ -1420,7 +1432,7 @@
      */    
     if (ch > 65535) {
       /* FIXME: uptex specific undocumented */
-      if (tfm_is_jfm(font->tfm_id)) {
+      if (!font->is_unicode && tfm_is_jfm(font->tfm_id)) {
         wbuf[0] = (UTF32toUTF16HS(ch) >> 8) & 0xff;
         wbuf[1] =  UTF32toUTF16HS(ch)       & 0xff;
         wbuf[2] = (UTF32toUTF16LS(ch) >> 8) & 0xff;
@@ -1431,17 +1443,21 @@
         wbuf[2] = (ch >>  8) & 0xff;
         wbuf[3] =  ch        & 0xff;
       }
-      cbytes  = 4;
+      n = 4;
     } else if (ch > 255) {
       wbuf[2] = (ch >> 8) & 0xff;
       wbuf[3] =  ch       & 0xff;
+      n = 2;
     } else if (font->subfont_id >= 0) {
       uint16_t uch = lookup_sfd_record(font->subfont_id, (unsigned char) ch);
       wbuf[2] = (uch >> 8) & 0xff;
       wbuf[3] =  uch       & 0xff;
+      n = 2;
     } else {
       wbuf[3] = (unsigned char) ch;
+      n = 1;
     }
+    cbytes = font->minbytes > n ? font->minbytes : n;
     set_string(dvi_state.h, -dvi_state.v, wbuf + 4 - cbytes, cbytes, width, font->font_id);
     if (dvi_is_tracking_boxes()) {
       pdf_rect rect;

Modified: trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2020-10-07 20:54:17 UTC (rev 56585)
+++ trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2020-10-07 21:01:34 UTC (rev 56586)
@@ -272,7 +272,7 @@
             dict = pdf_deref_obj(dict);
             pdf_release_obj(dict); /* FIXME: jus to decrement link counter */
           }
-#if 1
+#if 0
           /* This will leave garbage (object "res") since object "res"
            * supplied as resource dictionary will have label but we copy the
            * content of res here and never use reference to it.
@@ -895,19 +895,27 @@
   pdf_color  fc, sc;
   pdf_color *pfc, *psc;
 
+  skip_white(&ap->curptr, ap->endptr);
+
   pdf_color_get_current(&psc, &pfc);
-  if (ap->curptr <= ap->endptr + strlen("fill") &&
-      !memcmp(ap->curptr, "fill", strlen("fill"))) {
-    ap->curptr += strlen("fill");
-    skip_white(&ap->curptr, ap->endptr);
-    error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
+  if (ap->curptr < ap->endptr &&
+      (ap->curptr[0] == 'f' || ap->curptr[0] == 's')) {
     pdf_color_copycolor(&sc, psc);
-  } else if (ap->curptr <= ap->endptr + strlen("stroke") &&
-             !memcmp(ap->curptr, "stroke", strlen("stroke"))) {
-    ap->curptr += strlen("stroke");
-    skip_white(&ap->curptr, ap->endptr);
-    error = spc_util_read_pdfcolor(spe, &sc, ap, psc);
     pdf_color_copycolor(&fc, pfc);
+    while (!error && ap->curptr < ap->endptr) {
+      if (ap->curptr <= ap->endptr + strlen("fill") &&
+          !memcmp(ap->curptr, "fill", strlen("fill"))) {
+        ap->curptr += strlen("fill");
+        skip_white(&ap->curptr, ap->endptr);
+        error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
+      } else if (ap->curptr <= ap->endptr + strlen("stroke") &&
+                 !memcmp(ap->curptr, "stroke", strlen("stroke"))) {
+        ap->curptr += strlen("stroke");
+        skip_white(&ap->curptr, ap->endptr);
+        error = spc_util_read_pdfcolor(spe, &sc, ap, psc);
+      }
+      skip_white(&ap->curptr, ap->endptr);
+    }
   } else {
     error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
     if (!error) {
@@ -940,19 +948,27 @@
   pdf_color  fc, sc;
   pdf_color *pfc, *psc;
 
+  skip_white(&ap->curptr, ap->endptr);
+
   pdf_color_get_current(&psc, &pfc);
-  if (ap->curptr <= ap->endptr + strlen("fill") &&
-      !memcmp(ap->curptr, "fill", strlen("fill"))) {
-    ap->curptr += strlen("fill");
-    skip_white(&ap->curptr, ap->endptr);
-    error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
+  if (ap->curptr < ap->endptr &&
+      (ap->curptr[0] == 'f' || ap->curptr[0] == 's')) {
     pdf_color_copycolor(&sc, psc);
-  } else if (ap->curptr <= ap->endptr + strlen("stroke") &&
-             !memcmp(ap->curptr, "stroke", strlen("stroke"))) {
-    ap->curptr += strlen("stroke");
-    skip_white(&ap->curptr, ap->endptr);
-    error = spc_util_read_pdfcolor(spe, &sc, ap, psc);
     pdf_color_copycolor(&fc, pfc);
+    while (!error && ap->curptr < ap->endptr) {
+      if (ap->curptr <= ap->endptr + strlen("fill") &&
+          !memcmp(ap->curptr, "fill", strlen("fill"))) {
+        ap->curptr += strlen("fill");
+        skip_white(&ap->curptr, ap->endptr);
+        error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
+      } else if (ap->curptr <= ap->endptr + strlen("stroke") &&
+                 !memcmp(ap->curptr, "stroke", strlen("stroke"))) {
+        ap->curptr += strlen("stroke");
+        skip_white(&ap->curptr, ap->endptr);
+        error = spc_util_read_pdfcolor(spe, &sc, ap, psc);
+      }
+      skip_white(&ap->curptr, ap->endptr);
+    }
   } else {
     error = spc_util_read_pdfcolor(spe, &fc, ap, pfc);
     if (!error) {



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