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

Side by Side Diff: src/core/SkColorLookUpTable.cpp

Issue 2535383002: Fuzzer fix for overflow in some Lut8 profiles. (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkColorLookUpTable.h" 8 #include "SkColorLookUpTable.h"
9 #include "SkFloatingPoint.h" 9 #include "SkFloatingPoint.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 dst[i] = (ptr[n000] + diffZ * (ptr[n100] - ptr[n000]) + 85 dst[i] = (ptr[n000] + diffZ * (ptr[n100] - ptr[n000]) +
86 diffY * (ptr[n111] - ptr[n101]) + 86 diffY * (ptr[n111] - ptr[n101]) +
87 diffX * (ptr[n101] - ptr[n100])); 87 diffX * (ptr[n101] - ptr[n100]));
88 } else { 88 } else {
89 dst[i] = (ptr[n000] + diffZ * (ptr[n100] - ptr[n000]) + 89 dst[i] = (ptr[n000] + diffZ * (ptr[n100] - ptr[n000]) +
90 diffY * (ptr[n110] - ptr[n100]) + 90 diffY * (ptr[n110] - ptr[n100]) +
91 diffX * (ptr[n111] - ptr[n110])); 91 diffX * (ptr[n111] - ptr[n110]));
92 } 92 }
93 } 93 }
94 94
95 // TODO(raftias): Figure out why this is going out of range (up to 1.035 9!)
96 if (dst[i] > 1.f) {
97 dst[i] = 1.f;
98 } else if (dst[i] < 0.f) {
99 dst[i] = 0.f;
100 }
101
95 // Increment the table ptr in order to handle the next component. 102 // Increment the table ptr in order to handle the next component.
96 // Note that this is the how table is designed: all of nXXX 103 // Note that this is the how table is designed: all of nXXX
97 // variables are multiples of 3 because there are 3 output 104 // variables are multiples of 3 because there are 3 output
98 // components. 105 // components.
99 ptr++; 106 ptr++;
100 } 107 }
101 } 108 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698