texlive[47469] Build/source/texk/dvipdfm-x: dvipdfm-x: Fix a bug

commits+kakuto at tug.org commits+kakuto at tug.org
Sat Apr 28 08:09:57 CEST 2018


Revision: 47469
          http://tug.org/svn/texlive?view=revision&revision=47469
Author:   kakuto
Date:     2018-04-28 08:09:56 +0200 (Sat, 28 Apr 2018)
Log Message:
-----------
dvipdfm-x: Fix a bug which causes a segfault with 1/2/4-bit transparent indexed PNGs (Stefun Br\"uns).

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/pngimage.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-04-28 02:01:24 UTC (rev 47468)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-04-28 06:09:56 UTC (rev 47469)
@@ -1,3 +1,9 @@
+2018-04-28  Stefun Br\"uns  <stefan.bruens at rwth-aachen.de>
+
+	* pngimage.c: Fix a bug which causes a segfault with 1/2/4-bit
+	transparent indexed PNGs.
+	* configure.ac: Version 20180428.
+
 2018-03-03  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* xbb.c: Remove unused lines.

Modified: trunk/Build/source/texk/dvipdfm-x/configure
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure	2018-04-28 02:01:24 UTC (rev 47468)
+++ trunk/Build/source/texk/dvipdfm-x/configure	2018-04-28 06:09:56 UTC (rev 47469)
@@ -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) 20180217.
+# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20180428.
 #
 # Report bugs to <tex-k 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='20180217'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20180217'
+PACKAGE_VERSION='20180428'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20180428'
 PACKAGE_BUGREPORT='tex-k 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) 20180217 to adapt to many kinds of systems.
+\`configure' configures dvipdfm-x (TeX Live) 20180428 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) 20180217:";;
+     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20180428:";;
    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 20180217
+dvipdfm-x (TeX Live) configure 20180428
 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 20180217, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20180428, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -8075,7 +8075,7 @@
 
 # Define the identity of the package.
  PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20180217'
+ VERSION='20180428'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14744,7 +14744,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20180217
+dvipdfm-x (TeX Live) config.lt 20180428
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -16624,7 +16624,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 20180217, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20180428, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16694,7 +16694,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 20180217
+dvipdfm-x (TeX Live) config.status 20180428
 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	2018-04-28 02:01:24 UTC (rev 47468)
+++ trunk/Build/source/texk/dvipdfm-x/configure.ac	2018-04-28 06:09:56 UTC (rev 47469)
@@ -7,7 +7,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)], [20180217], [tex-k at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20180428], [tex-k 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/pngimage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pngimage.c	2018-04-28 02:01:24 UTC (rev 47468)
+++ trunk/Build/source/texk/dvipdfm-x/pngimage.c	2018-04-28 06:09:56 UTC (rev 47469)
@@ -964,6 +964,7 @@
   png_bytep   trans;
   int         num_trans;
   png_uint_32 i;
+  png_byte    bpc, mask, shift;
 
   if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
       !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) {
@@ -970,6 +971,9 @@
     WARN("%s: PNG does not have valid tRNS chunk but tRNS is requested.", PNG_DEBUG_STR);
     return NULL;
   }
+  bpc   = png_get_bit_depth(png_ptr, info_ptr);
+  mask  = 0xff >> (8 - bpc);
+  shift = 8 - bpc;
 
   smask = pdf_new_stream(STREAM_COMPRESS);
   dict  = pdf_stream_dict(smask);
@@ -981,7 +985,8 @@
   pdf_add_dict(dict, pdf_new_name("ColorSpace"), pdf_new_name("DeviceGray"));
   pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(8));
   for (i = 0; i < width*height; i++) {
-    png_byte idx = image_data_ptr[i];
+    /* data is packed for 1/2/4 bpc formats, msb first */
+    png_byte idx = (image_data_ptr[bpc * i / 8] >> (shift - bpc * i % 8)) & mask;
     smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
   }
   pdf_add_stream(smask, (char *)smask_data_ptr, width*height);



More information about the tex-live-commits mailing list