< prev index next >

src/java.desktop/share/native/libsplashscreen/libpng/pngread.c

Print this page
rev 55557 : 8217676: Upgrade libpng to 1.6.37
Reviewed-by: prr, jdv

*** 27,40 **** * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * ! * Last changed in libpng 1.6.35 [July 15, 2018] * Copyright (c) 1998-2002,2004,2006-2018 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.) * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h * --- 27,40 ---- * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * ! * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson ! * Copyright (c) 1996-1997 Andreas Dilger ! * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h *
*** 1020,1029 **** --- 1020,1035 ---- #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED png_free(png_ptr, png_ptr->chunk_list); png_ptr->chunk_list = NULL; #endif + #if defined(PNG_READ_EXPAND_SUPPORTED) && \ + defined(PNG_ARM_NEON_IMPLEMENTATION) + png_free(png_ptr, png_ptr->riffled_palette); + png_ptr->riffled_palette = NULL; + #endif + /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error * callbacks are still set at this point. They are required to complete the * destruction of the png_struct itself. */ }
*** 1647,1657 **** * too. This allows the simplified API to be compiled without iCCP support, * however if the support is there the chunk is still checked to detect * errors (which are unfortunately quite common.) */ { ! static PNG_CONST png_byte chunks_to_process[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 103, 65, 77, 65, '\0', /* gAMA */ # ifdef PNG_READ_iCCP_SUPPORTED 105, 67, 67, 80, '\0', /* iCCP */ --- 1653,1663 ---- * too. This allows the simplified API to be compiled without iCCP support, * however if the support is there the chunk is still checked to detect * errors (which are unfortunately quite common.) */ { ! static const png_byte chunks_to_process[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 103, 65, 77, 65, '\0', /* gAMA */ # ifdef PNG_READ_iCCP_SUPPORTED 105, 67, 67, 80, '\0', /* iCCP */
*** 1784,1796 **** png_create_colormap_entry(png_image_read_control *display, png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue, png_uint_32 alpha, int encoding) { png_imagep image = display->image; ! const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; ! const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && (red != green || green != blue); if (ip > 255) png_error(image->opaque->png_ptr, "color-map index out of range"); --- 1790,1802 ---- png_create_colormap_entry(png_image_read_control *display, png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue, png_uint_32 alpha, int encoding) { png_imagep image = display->image; ! int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; ! int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && (red != green || green != blue); if (ip > 255) png_error(image->opaque->png_ptr, "color-map index out of range");
*** 1895,1911 **** png_error(image->opaque->png_ptr, "bad encoding (internal error)"); /* Store the value. */ { # ifdef PNG_FORMAT_AFIRST_SUPPORTED ! const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED ! const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif if (output_encoding == P_LINEAR) --- 1901,1917 ---- png_error(image->opaque->png_ptr, "bad encoding (internal error)"); /* Store the value. */ { # ifdef PNG_FORMAT_AFIRST_SUPPORTED ! int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED ! int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif if (output_encoding == P_LINEAR)
*** 2111,2125 **** static int png_image_read_colormap(png_voidp argument) { png_image_read_control *display = png_voidcast(png_image_read_control*, argument); ! const png_imagep image = display->image; ! const png_structrp png_ptr = image->opaque->png_ptr; ! const png_uint_32 output_format = image->format; ! const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; unsigned int cmap_entries; unsigned int output_processing; /* Output processing option */ unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */ --- 2117,2131 ---- static int png_image_read_colormap(png_voidp argument) { png_image_read_control *display = png_voidcast(png_image_read_control*, argument); ! png_imagep image = display->image; ! png_structrp png_ptr = image->opaque->png_ptr; ! png_uint_32 output_format = image->format; ! int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; unsigned int cmap_entries; unsigned int output_processing; /* Output processing option */ unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */
*** 2828,2838 **** */ { unsigned int num_trans = png_ptr->num_trans; png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL; png_const_colorp colormap = png_ptr->palette; ! const int do_background = trans != NULL && (output_format & PNG_FORMAT_FLAG_ALPHA) == 0; unsigned int i; /* Just in case: */ if (trans == NULL) --- 2834,2844 ---- */ { unsigned int num_trans = png_ptr->num_trans; png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL; png_const_colorp colormap = png_ptr->palette; ! int do_background = trans != NULL && (output_format & PNG_FORMAT_FLAG_ALPHA) == 0; unsigned int i; /* Just in case: */ if (trans == NULL)
*** 3972,3982 **** /* If the *output* is 16-bit then we need to check for a byte-swap on this * architecture. */ if (linear != 0) { ! PNG_CONST png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); } --- 3978,3988 ---- /* If the *output* is 16-bit then we need to check for a byte-swap on this * architecture. */ if (linear != 0) { ! png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); }
*** 4134,4155 **** { /* Check for row_stride overflow. This check is not performed on the * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ ! const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be * either 1 or 2 bytes in size the length of a row can still overflow 32 * bits; this is just to verify that the 'row_stride' argument can be * represented. */ if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; ! const png_uint_32 png_row_stride = image->width * channels; if (row_stride == 0) row_stride = (png_int_32)/*SAFE*/png_row_stride; if (row_stride < 0) --- 4140,4161 ---- { /* Check for row_stride overflow. This check is not performed on the * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ ! unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be * either 1 or 2 bytes in size the length of a row can still overflow 32 * bits; this is just to verify that the 'row_stride' argument can be * represented. */ if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; ! png_uint_32 png_row_stride = image->width * channels; if (row_stride == 0) row_stride = (png_int_32)/*SAFE*/png_row_stride; if (row_stride < 0)
< prev index next >