Bug 1176551 - Don't reject valid profiles with no CLUT offset. r=jrmuizel
authorBenoit Girard <b56girard@gmail.com>
Tue, 23 Jun 2015 17:49:39 -0700
changeset 268160 e15a71e0f6f3819ea5342d51969730ce914efe61
parent 268159 ae84f9adafc7ec4621687a1264a3b1b5cf3e42be
child 268161 30f68d9c65a5964f312b2b512de2aab17fbb0683
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1176551
milestone41.0a1
Bug 1176551 - Don't reject valid profiles with no CLUT offset. r=jrmuizel
gfx/qcms/iccread.c
--- a/gfx/qcms/iccread.c
+++ b/gfx/qcms/iccread.c
@@ -600,22 +600,24 @@ static struct lutmABType *read_tag_lutmA
 
 	lut = malloc(sizeof(struct lutmABType) + (clut_size) * sizeof(float));
 	if (!lut)
 		return NULL;
 	// we'll fill in the rest below
 	memset(lut, 0, sizeof(struct lutmABType));
 	lut->clut_table   = &lut->clut_table_data[0];
 
-	for (i = 0; i < num_in_channels; i++) {
-		lut->num_grid_points[i] = read_u8(src, clut_offset + i);
-		if (lut->num_grid_points[i] == 0) {
-			invalid_source(src, "bad grid_points");
+        if (clut_offset) {
+		for (i = 0; i < num_in_channels; i++) {
+			lut->num_grid_points[i] = read_u8(src, clut_offset + i);
+			if (lut->num_grid_points[i] == 0) {
+				invalid_source(src, "bad grid_points");
+			}
 		}
-	}
+        }
 
 	// Reverse the processing of transformation elements for mBA type.
 	lut->reversed = (type == LUT_MBA_TYPE);
 
 	lut->num_in_channels = num_in_channels;
 	lut->num_out_channels = num_out_channels;
 
 	if (matrix_offset) {