| Index: third_party/libpng/pngset.c
|
| diff --git a/third_party/libpng/pngset.c b/third_party/libpng/pngset.c
|
| index 717757fc40c72939a371d9deb4bdd315ba2b141d..fed6a55b82a99d8b0f39ac2785a33b650f202836 100644
|
| --- a/third_party/libpng/pngset.c
|
| +++ b/third_party/libpng/pngset.c
|
| @@ -1,8 +1,8 @@
|
|
|
| /* pngset.c - storage of image information into info struct
|
| *
|
| - * Last changed in libpng 1.2.43 [February 25, 2010]
|
| - * Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
| + * Last changed in libpng 1.2.51 [February 6, 2014]
|
| + * Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
| * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
| * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
| *
|
| @@ -533,9 +533,11 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
| #ifdef PNG_FLOATING_POINT_SUPPORTED
|
| float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
| #endif
|
| +#ifdef PNG_FIXED_POINT_SUPPORTED
|
| png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
| int_green_y, int_blue_x, int_blue_y;
|
| #endif
|
| +#endif
|
| png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
|
|
|
| if (png_ptr == NULL || info_ptr == NULL)
|
| @@ -555,6 +557,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
| #endif
|
|
|
| #ifdef PNG_cHRM_SUPPORTED
|
| +# ifdef PNG_FIXED_POINT_SUPPORTED
|
| int_white_x = 31270L;
|
| int_white_y = 32900L;
|
| int_red_x = 64000L;
|
| @@ -563,8 +566,12 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
| int_green_y = 60000L;
|
| int_blue_x = 15000L;
|
| int_blue_y = 6000L;
|
| + png_set_cHRM_fixed(png_ptr, info_ptr,
|
| + int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
| + int_green_y, int_blue_x, int_blue_y);
|
| +# endif
|
|
|
| -#ifdef PNG_FLOATING_POINT_SUPPORTED
|
| +# ifdef PNG_FLOATING_POINT_SUPPORTED
|
| white_x = (float).3127;
|
| white_y = (float).3290;
|
| red_x = (float).64;
|
| @@ -573,17 +580,9 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
| green_y = (float).60;
|
| blue_x = (float).15;
|
| blue_y = (float).06;
|
| -#endif
|
| -
|
| -#ifdef PNG_FIXED_POINT_SUPPORTED
|
| - png_set_cHRM_fixed(png_ptr, info_ptr,
|
| - int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
| - int_green_y, int_blue_x, int_blue_y);
|
| -#endif
|
| -#ifdef PNG_FLOATING_POINT_SUPPORTED
|
| png_set_cHRM(png_ptr, info_ptr,
|
| white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
|
| -#endif
|
| +# endif
|
| #endif /* cHRM */
|
| }
|
| #endif /* sRGB */
|
| @@ -667,22 +666,26 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
| */
|
| if (info_ptr->num_text + num_text > info_ptr->max_text)
|
| {
|
| + int old_max_text = info_ptr->max_text;
|
| + int old_num_text = info_ptr->num_text;
|
| +
|
| if (info_ptr->text != NULL)
|
| {
|
| png_textp old_text;
|
| - int old_max;
|
|
|
| - old_max = info_ptr->max_text;
|
| info_ptr->max_text = info_ptr->num_text + num_text + 8;
|
| old_text = info_ptr->text;
|
| +
|
| info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
| (png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
|
| if (info_ptr->text == NULL)
|
| {
|
| - png_free(png_ptr, old_text);
|
| + /* Restore to previous condition */
|
| + info_ptr->max_text = old_max_text;
|
| + info_ptr->text = old_text;
|
| return(1);
|
| }
|
| - png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
| + png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max_text *
|
| png_sizeof(png_text)));
|
| png_free(png_ptr, old_text);
|
| }
|
| @@ -693,7 +696,12 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
| info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
| (png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
|
| if (info_ptr->text == NULL)
|
| + {
|
| + /* Restore to previous condition */
|
| + info_ptr->num_text = old_num_text;
|
| + info_ptr->max_text = old_max_text;
|
| return(1);
|
| + }
|
| #ifdef PNG_FREE_ME_SUPPORTED
|
| info_ptr->free_me |= PNG_FREE_TEXT;
|
| #endif
|
| @@ -701,6 +709,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
| png_debug1(3, "allocated %d entries for info_ptr->text",
|
| info_ptr->max_text);
|
| }
|
| +
|
| for (i = 0; i < num_text; i++)
|
| {
|
| png_size_t text_length, key_len;
|
| @@ -840,6 +849,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
| if (png_ptr == NULL || info_ptr == NULL)
|
| return;
|
|
|
| + if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH)
|
| + {
|
| + png_warning(png_ptr, "Ignoring invalid num_trans value");
|
| + return;
|
| + }
|
| +
|
| if (trans != NULL)
|
| {
|
| /* It may not actually be necessary to set png_ptr->trans here;
|
| @@ -1174,7 +1189,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
|
| /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
|
| if (png_ptr != NULL)
|
| png_ptr->asm_flags = 0;
|
| - asm_flags = asm_flags; /* Quiet the compiler */
|
| + PNG_UNUSED(asm_flags) /* Quiet the compiler */
|
| }
|
|
|
| /* This function was added to libpng 1.2.0 */
|
| @@ -1187,8 +1202,8 @@ png_set_mmx_thresholds (png_structp png_ptr,
|
| if (png_ptr == NULL)
|
| return;
|
| /* Quiet the compiler */
|
| - mmx_bitdepth_threshold = mmx_bitdepth_threshold;
|
| - mmx_rowbytes_threshold = mmx_rowbytes_threshold;
|
| + PNG_UNUSED(mmx_bitdepth_threshold)
|
| + PNG_UNUSED(mmx_rowbytes_threshold)
|
| }
|
| #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
|
|
|