Bug 498245. Check that the profile is an RGB profile before checking if it's bogus. r=bholley
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 02 Jul 2009 11:34:08 -0400
changeset 29965 a59ff49215b54a52455abc36cd14cd3d29303b17
parent 29964 b95e64e9431e35365bcc82c9695ee89e95c5d6ce
child 29966 6d2ad89d3afaec8731d6ef1e6878a278b25548b3
push idunknown
push userunknown
push dateunknown
reviewersbholley
bugs498245
milestone1.9.2a1pre
Bug 498245. Check that the profile is an RGB profile before checking if it's bogus. r=bholley This avoids unitialized reads on non-RGB profiles.
gfx/qcms/iccread.c
--- a/gfx/qcms/iccread.c
+++ b/gfx/qcms/iccread.c
@@ -222,16 +222,20 @@ static struct tag_index read_tag_table(q
 // ignored.
 qcms_bool qcms_profile_is_bogus(qcms_profile *profile)
 {
        float sum[3], target[3], tolerance[3];
        float rX, rY, rZ, gX, gY, gZ, bX, bY, bZ;
        bool negative;
        unsigned i;
 
+       // We currently only check the bogosity of RGB profiles
+       if (profile->color_space != RGB_SIGNATURE)
+	       return false;
+
        rX = s15Fixed16Number_to_float(profile->redColorant.X);
        rY = s15Fixed16Number_to_float(profile->redColorant.Y);
        rZ = s15Fixed16Number_to_float(profile->redColorant.Z);
 
        gX = s15Fixed16Number_to_float(profile->greenColorant.X);
        gY = s15Fixed16Number_to_float(profile->greenColorant.Y);
        gZ = s15Fixed16Number_to_float(profile->greenColorant.Z);