Bug 1163740 - Paper over qcms crashes due to NaN values in qcms_transform::matrix. r=dmajor
authorSeth Fowler <mark.seth.fowler@gmail.com>
Tue, 26 May 2015 17:34:21 -0700
changeset 245760 c752c5732061d2609afef98c576fee794e463849
parent 245759 be715c1edaeb02a739a22d6edb5f00065ac19e72
child 245761 1f9f41d4dbab5f4c980bc628fdaa339d5f81d06c
push id28816
push userkwierso@gmail.com
push dateThu, 28 May 2015 00:03:18 +0000
treeherdermozilla-central@8707d35414f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1163740
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1163740 - Paper over qcms crashes due to NaN values in qcms_transform::matrix. r=dmajor
gfx/qcms/transform.c
--- a/gfx/qcms/transform.c
+++ b/gfx/qcms/transform.c
@@ -1332,16 +1332,26 @@ qcms_transform* qcms_transform_create(
 		out_matrix = build_colorant_matrix(out);
 		out_matrix = matrix_invert(out_matrix);
 		if (out_matrix.invalid) {
 			qcms_transform_release(transform);
 			return NULL;
 		}
 		result = matrix_multiply(out_matrix, in_matrix);
 
+		/* check for NaN values in the matrix and bail if we find any */
+		for (unsigned i = 0 ; i < 3 ; ++i) {
+			for (unsigned j = 0 ; j < 3 ; ++j) {
+				if (result.m[i][j] != result.m[i][j]) {
+					qcms_transform_release(transform);
+					return NULL;
+				}
+			}
+		}
+
 		/* store the results in column major mode
 		 * this makes doing the multiplication with sse easier */
 		transform->matrix[0][0] = result.m[0][0];
 		transform->matrix[1][0] = result.m[0][1];
 		transform->matrix[2][0] = result.m[0][2];
 		transform->matrix[0][1] = result.m[1][0];
 		transform->matrix[1][1] = result.m[1][1];
 		transform->matrix[2][1] = result.m[1][2];