mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[master] Issue warning instead of error for out of range coefficients
for rgb_to_gray transform
This commit is contained in:
13
pngrtran.c
13
pngrtran.c
@@ -665,9 +665,16 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
|
|||||||
return;
|
return;
|
||||||
if (red > 21474.83647 || red < -21474.83648 ||
|
if (red > 21474.83647 || red < -21474.83648 ||
|
||||||
green > 21474.83647 || green < -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);
|
png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
|
||||||
green_fixed = (int)((float)green*100000.0 + 0.5);
|
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);
|
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user