[libpng16] Avoid conditional directives that break statements in pngrutil.c (Romero
Malaquias)
This commit is contained in:
parent
c3f4e5fb1a
commit
f604c74a5f
6
ANNOUNCE
6
ANNOUNCE
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.29beta02 - January 12, 2017
|
Libpng 1.6.29beta02 - January 20, 2017
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
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.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -32,7 +32,9 @@ Version 1.6.29beta01 [January 12, 2017]
|
|||||||
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
||||||
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
|
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
|
||||||
|
|
||||||
Version 1.6.29beta02 [January 12, 2017]
|
Version 1.6.29beta02 [January 20, 2017]
|
||||||
|
Avoid conditional directives that break statements in pngrutil.c (Romero
|
||||||
|
Malaquias)
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
4
CHANGES
4
CHANGES
@ -5801,7 +5801,9 @@ Version 1.6.29beta01 [January 12, 2017]
|
|||||||
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
||||||
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
|
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
|
||||||
|
|
||||||
Version 1.6.29beta02 [January 12, 2017]
|
Version 1.6.29beta02 [January 20, 2017]
|
||||||
|
Avoid conditional directives that break statements in pngrutil.c (Romero
|
||||||
|
Malaquias)
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
15
pngwutil.c
15
pngwutil.c
@ -675,10 +675,9 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
int interlace_type)
|
int interlace_type)
|
||||||
{
|
{
|
||||||
png_byte buf[13]; /* Buffer to store the IHDR info */
|
png_byte buf[13]; /* Buffer to store the IHDR info */
|
||||||
|
int is_invalid_depth;
|
||||||
|
|
||||||
png_debug(1, "in png_write_IHDR");
|
png_debug(1, "in png_write_IHDR");
|
||||||
|
|
||||||
int is_invalid_depth;
|
|
||||||
|
|
||||||
/* Check that we have valid input data from the application info */
|
/* Check that we have valid input data from the application info */
|
||||||
switch (color_type)
|
switch (color_type)
|
||||||
@ -728,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||||
if (bit_depth != 8 && bit_depth != 16)
|
is_invalid_depth = (bit_depth != 8);
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
|
is_invalid_depth = (is_invalid_depth && bit_depth != 16);
|
||||||
|
#endif
|
||||||
|
if (is_invalid_depth)
|
||||||
png_error(png_ptr, "Invalid bit depth for grayscale+alpha image");
|
png_error(png_ptr, "Invalid bit depth for grayscale+alpha image");
|
||||||
|
|
||||||
png_ptr->channels = 2;
|
png_ptr->channels = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||||
|
is_invalid_depth = (bit_depth != 8);
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
if (bit_depth != 8 && bit_depth != 16)
|
is_invalid_depth = (is_invalid_depth && bit_depth != 16);
|
||||||
#else
|
|
||||||
if (bit_depth != 8)
|
|
||||||
#endif
|
#endif
|
||||||
|
if (is_invalid_depth)
|
||||||
png_error(png_ptr, "Invalid bit depth for RGBA image");
|
png_error(png_ptr, "Invalid bit depth for RGBA image");
|
||||||
|
|
||||||
png_ptr->channels = 4;
|
png_ptr->channels = 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user