[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

@@ -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.)