[libpng16] Fix bug in calculation of maxbits, in png_write_sBIT, introduced

in libpng-1.6.17beta01 (John Bowler).
This commit is contained in:
John Bowler
2015-03-16 16:31:13 -05:00
committed by Glenn Randers-Pehrson
parent 47e1315459
commit c9fd075c89
3 changed files with 13 additions and 5 deletions

View File

@@ -1348,8 +1348,8 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
{
png_byte maxbits;
maxbits = color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
(png_byte)(png_ptr->usr_bit_depth & 0xff);
maxbits = (png_byte)((color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
png_ptr->usr_bit_depth) & 0xff);
if (sbit->red == 0 || sbit->red > maxbits ||
sbit->green == 0 || sbit->green > maxbits ||