From 70850fce0c3e115fdad5d4652841b7ff0d048b2f Mon Sep 17 00:00:00 2001 From: John Bowler Date: Thu, 15 Nov 2012 00:06:30 -0600 Subject: [PATCH] [libpng16] Fixed error checking in the simplified write API (Olaf van der Spek) --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngwrite.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 69ecf2193..22ce328b8 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta32 - November 14, 2012 +Libpng 1.6.0beta32 - November 15, 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. @@ -545,10 +545,11 @@ Version 1.6.0beta31 [November 1, 2012] gain; implementing full ICC color correction may be desireable but is left up to applications. -Version 1.6.0beta32 [November 14, 2012] +Version 1.6.0beta32 [November 15, 2012] Fixed an intermittent SEGV in pngstest due to an uninitialized array element. Added the ability for contrib/libtests/makepng.c to make a PNG with just one color. This is useful for debugging pngstest color inaccuracy reports. + Fixed error checking in the simplified write API (Olaf van der Spek) Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index b34132166..1b0e2f1d8 100644 --- a/CHANGES +++ b/CHANGES @@ -4297,10 +4297,11 @@ Version 1.6.0beta31 [November 1, 2012] gain; implementing full ICC color correction may be desireable but is left up to applications. -Version 1.6.0beta32 [November 14, 2012] +Version 1.6.0beta32 [November 15, 2012] Fixed an intermittent SEGV in pngstest due to an uninitialized array element. Added the ability for contrib/libtests/makepng.c to make a PNG with just one color. This is useful for debugging pngstest color inaccuracy reports. + Fixed error checking in the simplified write API (Olaf van der Spek) Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngwrite.c b/pngwrite.c index 4e33ee08b..36886e07c 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1595,7 +1595,7 @@ png_image_write_init(png_imagep image) png_destroy_write_struct(&png_ptr, NULL); } - return png_image_error(image, "png_image_read: out of memory"); + return png_image_error(image, "png_image_write_: out of memory"); } /* Arguments to png_image_write_main: */ @@ -2212,7 +2212,7 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { /* Write the image to the given (FILE*). */ - if (image != NULL || image->version != PNG_IMAGE_VERSION) + if (image != NULL && image->version == PNG_IMAGE_VERSION) { if (file != NULL) { @@ -2262,7 +2262,7 @@ png_image_write_to_file(png_imagep image, const char *file_name, const void *colormap) { /* Write the image to the named file. */ - if (image != NULL || image->version != PNG_IMAGE_VERSION) + if (image != NULL && image->version == PNG_IMAGE_VERSION) { if (file_name != NULL) {