Fix white_point_from_temp to handle out of range input.
Mozilla bug 550969
diff --git a/iccread.c b/iccread.c
index 36b7011..ff0572f 100644
--- a/iccread.c
+++ b/iccread.c
@@ -917,6 +917,8 @@
/* from lcms: cmsWhitePointFromTemp */
/* tempK must be >= 4000. and <= 25000.
+ * Invalid values of tempK will return
+ * (x,y,Y) = (-1.0, -1.0, -1.0)
* similar to argyll: icx_DTEMP2XYZ() */
static qcms_CIE_xyY white_point_from_temp(int temp_K)
{
@@ -938,7 +940,14 @@
if (T > 7000.0 && T <= 25000.0) {
x = -2.0064*(1E9/T3) + 1.9018*(1E6/T2) + 0.24748*(1E3/T) + 0.237040;
} else {
+ // Invalid tempK
+ white_point.x = -1.0;
+ white_point.y = -1.0;
+ white_point.Y = -1.0;
+
assert(0 && "invalid temp");
+
+ return white_point;
}
}