check for NaN etc. in XYZ2sRGB
we were not checking for Inf, NaN etc. and this could cause array indexes to go out of range
This commit is contained in:
parent
0274a36863
commit
77ec00b495
@ -264,6 +264,19 @@ vips_col_XYZ2sRGB( int range, int *lut,
|
|||||||
int Yi;
|
int Yi;
|
||||||
float v;
|
float v;
|
||||||
|
|
||||||
|
/* XYZ can be Nan, Inf etc. Throw those values out, they will break
|
||||||
|
* our clipping.
|
||||||
|
*/
|
||||||
|
if( !isnormal( X ) ||
|
||||||
|
!isnormal( Y ) ||
|
||||||
|
!isnormal( Z ) ) {
|
||||||
|
*r = 0;
|
||||||
|
*g = 0;
|
||||||
|
*b = 0;
|
||||||
|
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
/* Multiply through the matrix to get luminosity values.
|
/* Multiply through the matrix to get luminosity values.
|
||||||
*/
|
*/
|
||||||
Yr = vips_mat_XYZ2RGB[0][0] * X +
|
Yr = vips_mat_XYZ2RGB[0][0] * X +
|
||||||
|
Loading…
Reference in New Issue
Block a user