From 8c8aea7fd4a2357a584dc53e5ff7b6782631fea6 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Wed, 8 Jun 2016 10:43:25 -0700 Subject: [PATCH] png_app_warning fix The implementations of png_app_error and png_app_warning were swapped. The non-release behavior of using PNG_ERROR on both doesn't work in practice because there are some cases where the warnings are very mild (specifically the one about writing an iCCP chunk when sRGB could be used.) png_app_warning now does PNG_WARN by default in all cases. Signed-off-by: John Bowler --- pngerror.c | 4 ++-- pngread.c | 4 ++-- pngwrite.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pngerror.c b/pngerror.c index 453ff07b7..c6e2d606e 100644 --- a/pngerror.c +++ b/pngerror.c @@ -353,13 +353,13 @@ app_error(png_const_structrp png_ptr, png_const_charp error_message, void /* PRIVATE */ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message) { - app_error(png_ptr, error_message, png_ptr->app_error_action); + app_error(png_ptr, error_message, png_ptr->app_warning_action); } void /* PRIVATE */ png_app_error(png_const_structrp png_ptr, png_const_charp error_message) { - app_error(png_ptr, error_message, png_ptr->app_warning_action); + app_error(png_ptr, error_message, png_ptr->app_error_action); } #endif /* BENIGN_ERRORS */ diff --git a/pngread.c b/pngread.c index b5fc7aad1..ec49cdfa4 100644 --- a/pngread.c +++ b/pngread.c @@ -56,7 +56,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, # if !PNG_RELEASE_BUILD /* Always quit on error prior to release */ png_ptr->benign_error_action = PNG_ERROR; - png_ptr->app_warning_action = PNG_ERROR; + png_ptr->app_warning_action = PNG_WARN; png_ptr->app_error_action = PNG_ERROR; # else /* RELEASE_BUILD */ /* Allow benign errors on read, subject to app control. */ @@ -68,7 +68,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, /* libpng build without benign error support; the application * author has to be assumed to be correct, so: */ - png_ptr->app_warning_action = PNG_ERROR; + png_ptr->app_warning_action = PNG_WARN; png_ptr->app_error_action = PNG_ERROR; # endif /* !BENIGN_READ_ERRORS */ # endif /* RELEASE_BUILD */ diff --git a/pngwrite.c b/pngwrite.c index b3ee9c89d..970eb4131 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -542,7 +542,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, # if !PNG_RELEASE_BUILD /* Always quit on error prior to release */ png_ptr->benign_error_action = PNG_ERROR; - png_ptr->app_warning_action = PNG_ERROR; + png_ptr->app_warning_action = PNG_WARN; png_ptr->app_error_action = PNG_ERROR; # else /* RELEASE_BUILD */ /* Allow benign errors on write, subject to app control. */ @@ -555,7 +555,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, * author has to be assumed to be correct, so: */ png_ptr->benign_error_action = PNG_ERROR; - png_ptr->app_warning_action = PNG_ERROR; + png_ptr->app_warning_action = PNG_WARN; png_ptr->app_error_action = PNG_ERROR; # endif /* !BENIGN_WRITE_ERRORS */ # endif /* RELEASE_BUILD */