From 905cc94e3dcaa11bead936f4a49d8d7f3636f05c Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Thu, 7 Jun 2012 10:18:25 -0500 Subject: [PATCH] [libpng16] Don't check palette indexes if num_palette is 0 (as it can be in MNG files). --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngtrans.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 5abf7abe5..3dbb6fc5d 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta24 - June 6, 2012 +Libpng 1.6.0beta24 - June 7, 2012 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -380,7 +380,8 @@ Version 1.6.0beta23 [June 6, 2012] update the value when it actually increases, move test for whether the check is wanted out of the function. -Version 1.6.0beta24 [June 6, 2012] +Version 1.6.0beta24 [June 7, 2012] + Don't check palette indexes if num_palette is 0 (as it can be in MNG files). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 1ed594fd8..d52e35a92 100644 --- a/CHANGES +++ b/CHANGES @@ -4131,7 +4131,8 @@ Version 1.6.0beta23 [June 6, 2012] update the value when it actually increases, move test for whether the check is wanted out of the function. -Version 1.6.0beta24 [June 6, 2012] +Version 1.6.0beta24 [June 7, 2012] + Don't check palette indexes if num_palette is 0 (as it can be in MNG files). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtrans.c b/pngtrans.c index 1d4bf6122..bbf97a642 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -625,7 +625,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) { - if (png_ptr->num_palette < (1 << row_info->bit_depth)) + if (png_ptr->num_palette < (1 << row_info->bit_depth) && + png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */ { /* Calculations moved outside switch in an attempt to stop different * compiler warnings. 'padding' is in *bits* within the last byte, it is