diff --git a/ANNOUNCE b/ANNOUNCE index efa998d18..3fb484e2b 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -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 diff --git a/CHANGES b/CHANGES index 50ce595db..97c7e2c3a 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/pngrtran.c b/pngrtran.c index 9419c332a..ef4eca1d1 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -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.)