Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: third_party/qcms/src/iccread.c

Issue 2796923002: [qcms] Only accept valid input ranges when reading VCGT formula (Closed)
Patch Set: Fix QCMS tab vs. spaces per usual. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/qcms/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim: set ts=8 sw=8 noexpandtab: */ 1 /* vim: set ts=8 sw=8 noexpandtab: */
2 // qcms 2 // qcms
3 // Copyright (C) 2009 Mozilla Foundation 3 // Copyright (C) 2009 Mozilla Foundation
4 // Copyright (C) 1998-2007 Marti Maria 4 // Copyright (C) 1998-2007 Marti Maria
5 // 5 //
6 // Permission is hereby granted, free of charge, to any person obtaining 6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"), 7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation 8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 float gamma = s15Fixed16Number_to_float( 472 float gamma = s15Fixed16Number_to_float(
473 read_s15Fixed16Number(src, formula_offse t + 12 * i)); 473 read_s15Fixed16Number(src, formula_offse t + 12 * i));
474 float min = s15Fixed16Number_to_float( 474 float min = s15Fixed16Number_to_float(
475 read_s15Fixed16Number(src, formula_offse t + 4 + 12 * i)); 475 read_s15Fixed16Number(src, formula_offse t + 4 + 12 * i));
476 float max = s15Fixed16Number_to_float( 476 float max = s15Fixed16Number_to_float(
477 read_s15Fixed16Number(src, formula_offse t + 8 + 12 * i)); 477 read_s15Fixed16Number(src, formula_offse t + 8 + 12 * i));
478 float range = max - min; 478 float range = max - min;
479 479
480 if (!src->valid) 480 if (!src->valid)
481 goto invalid_vcgt_tag; 481 goto invalid_vcgt_tag;
482 if (gamma <= 0)
483 goto invalid_vcgt_tag;
484 if (min <= 0 || min > 1.f)
485 goto invalid_vcgt_tag;
486 if (max <= 0 || max > 1.f || min > max)
487 goto invalid_vcgt_tag;
482 488
483 for (j = 0; j < profile->vcgt.length; ++j) { 489 for (j = 0; j < profile->vcgt.length; ++j) {
484 *dest++ = 65535.f * 490 *dest++ = 65535.f *
485 (min + range * pow((float)j / (profile-> vcgt.length - 1), gamma)); 491 (min + range * pow((float)j / (profile-> vcgt.length - 1), gamma));
486 } 492 }
487 } 493 }
488 } 494 }
489 495
490 return true; 496 return true;
491 497
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 { 1643 {
1638 qcms_profile *profile = NULL; 1644 qcms_profile *profile = NULL;
1639 FILE *file = _wfopen(path, L"rb"); 1645 FILE *file = _wfopen(path, L"rb");
1640 if (file) { 1646 if (file) {
1641 profile = qcms_profile_from_file(file); 1647 profile = qcms_profile_from_file(file);
1642 fclose(file); 1648 fclose(file);
1643 } 1649 }
1644 return profile; 1650 return profile;
1645 } 1651 }
1646 #endif 1652 #endif
OLDNEW
« no previous file with comments | « third_party/qcms/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698