diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-03-01 21:39:29 -0600 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-03-01 21:39:29 -0600 |
commit | 363ae65e2b20c06895d4c4c065368654ae9eba63 (patch) | |
tree | f2999d4202a2d599eb400e74ced74da1893b53d0 /pngwrite.c | |
parent | cb129a623420325354c524f72006973a4092fed7 (diff) | |
download | libpng-363ae65e2b20c06895d4c4c065368654ae9eba63.tar.gz |
[libpng16] Added tests for invalid palette index while reading and writing
(work in progress, the latter isn't finished).
Diffstat (limited to 'pngwrite.c')
-rw-r--r-- | pngwrite.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pngwrite.c b/pngwrite.c index 8281b64f2..c6f772a74 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -731,12 +731,15 @@ png_write_row(png_structrp png_ptr, png_const_bytep row) } #endif -#if 0 /* To do: implement png_do_check_palette_indexes() */ +/* Added at libpng-1.5.10 */ +#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Check for out-of-range palette index */ +#if 0 /* To do: implement png_do_check_palette_indexes() */ if (png_ptr->num_palette < (1 << png_ptr->bit_depth)) png_do_check_palette_indexes(&row_info, png_ptr->row_buf + 1, png_ptr->num_palette_max); - if (png_ptr->num_palette_max > num_palette + 1) +#endif + if (png_ptr->num_palette_max > png_ptr->num_palette + 1) png_warning(png_ptr, "Palette index exceeded num_palette"); #endif |