[tex-live] [xetex:bugs] #151 Segfault with 1/2/4-bit transparent indexed PNGs

Dr. Werner Fink werner at suse.de
Wed May 2 10:30:21 CEST 2018


This one seems to be missed in texlive-20180414-source.tar.xz

On Mon, Apr 30, 2018 at 03:36:14AM +0000, Akira Kakuto wrote:
> Applied the patch by Stefan for dvipdfm-x in TeX Live SVN: r47469.
> 
> 
> ---
> 
> ** [bugs:#151] Segfault with 1/2/4-bit transparent indexed PNGs **
> 
> **Status:** open
> **Group:** Future
> **Created:** Fri Apr 27, 2018 12:12 AM UTC by Anonymous
> **Last Updated:** Fri Apr 27, 2018 12:53 PM UTC
> **Owner:** nobody
> 
> 
> The code in pngimage.c, create_soft_mask(...) assumes the data stream containing the palette index bytes is 8 bits-per-color (-index).
> ~~~
>   for (i = 0; i < width*height; i++) {
>     png_byte idx = image_data_ptr[i];
>     smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
>   }
> ~~~
> 
> This accesses the wrong data, the block should read
> ~~~
> png_byte mask = 0xff >> (8 - bpc);
> for (i = 0; i < width*height; i++) {
>     /* data is packed for 1/2/4 bpc formats, msb first */
>     png_byte idx = (image_data_ptr[bpc * i / 8] >> (3 - bpc * i % 8)) & mask;
>     smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
> }
> ~~~

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 880 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-live/attachments/20180502/e871d1df/attachment.sig>


More information about the tex-live mailing list