[libpng16] Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.

This commit is contained in:
John Bowler 2012-03-28 11:38:02 -05:00 committed by Glenn Randers-Pehrson
parent 48015617d3
commit 23a30f8583
3 changed files with 5 additions and 0 deletions

View File

@ -344,6 +344,7 @@ Version 1.6.0beta20 [March 28, 2012]
Recognize known sRGB ICC profiles while reading and issue a warning about
it, if PNG_WARN_IF_iCCP_IS_sRGB_SUPPORTED is defined.
Added checksum-icc.c to contrib/tools
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4095,6 +4095,7 @@ Version 1.6.0beta20 [March 28, 2012]
Recognize known sRGB ICC profiles while reading and issue a warning about
it, if PNG_WARN_IF_iCCP_IS_sRGB_SUPPORTED is defined.
Added checksum-icc.c to contrib/tools
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -1866,12 +1866,15 @@ png_init_read_transformations(png_structrp png_ptr)
#ifdef PNG_READ_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) &&
!(png_ptr->transformations & PNG_EXPAND) &&
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
{
int i;
int istop = png_ptr->num_palette;
int shift = 8 - png_ptr->sig_bit.red;
png_ptr->transformations &= ~PNG_SHIFT;
/* significant bits can be in the range 1 to 7 for a meaninful result, if
* the number of significant bits is 0 then no shift is done (this is an
* error condition which is silently ignored.)