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

Unified Diff: third_party/qcms/src/transform_util.c

Issue 2825623002: [qcms] Fix integer overflow in lut_inverse_interp16 (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/qcms/README.chromium ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/qcms/src/transform_util.c
diff --git a/third_party/qcms/src/transform_util.c b/third_party/qcms/src/transform_util.c
index 1d7b153ad5e41d1e78dbcca457d887646d27c1e5..56125ad3b296c0c76de4b0c10c06065acc1bb360 100644
--- a/third_party/qcms/src/transform_util.c
+++ b/third_party/qcms/src/transform_util.c
@@ -340,7 +340,8 @@ uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int len
// Does the curve belong to this case?
if (NumZeroes > 1 || NumPoles > 1)
{
- int a, b, sample;
+ float a, b;
+ int sample;
// Identify if value fall downto 0 or FFFF zone
if (Value == 0) return 0;
@@ -351,11 +352,11 @@ uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int len
// else restrict to valid zone
- a = ((NumZeroes-1) * 0xFFFF) / (length-1);
- b = ((length-1 - NumPoles) * 0xFFFF) / (length-1);
+ a = ((NumZeroes-1) * 65535.f) / (length-1);
+ b = ((length-1 - NumPoles) * 65535.f) / (length-1);
- l = a - 1;
- r = b + 1;
+ l = ((int)a) - 1;
+ r = ((int)b) + 1;
// Ensure a valid binary search range
« 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