diff --git a/pngrtran.c b/pngrtran.c index 9012f6fe9..1bb6b2406 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -665,9 +665,16 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, return; if (red > 21474.83647 || red < -21474.83648 || green > 21474.83647 || green < -21474.83648) - png_error(png_ptr, "ignoring out of range rgb_to_gray coefficients"); - red_fixed = (int)((float)red*100000.0 + 0.5); - green_fixed = (int)((float)green*100000.0 + 0.5); + { + png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients"); + red_fixed = -1; + green_fixed = -1; + } + else + { + red_fixed = (int)((float)red*100000.0 + 0.5); + green_fixed = (int)((float)green*100000.0 + 0.5); + } png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); } #endif