aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-11-17 15:46:32 +0900
committersatok <satok@google.com>2011-11-17 16:34:05 +0900
commit4c1dfc62c8d59c7503d3635c96a4c1582f9d9e8a (patch)
treea154c4649f53f0d30ab4dafbba2980f3497fd191 /native/src
parent1c0f94c5916921ee861933e080d7b0f711b019e1 (diff)
downloadlatinime-4c1dfc62c8d59c7503d3635c96a4c1582f9d9e8a.tar.gz
latinime-4c1dfc62c8d59c7503d3635c96a4c1582f9d9e8a.tar.xz
latinime-4c1dfc62c8d59c7503d3635c96a4c1582f9d9e8a.zip
Fix a critical underflow in the touch calibration. This is a cherry-pick of Iacc746e1cc97bf3
Bug: 5629373 Change-Id: Ia198fe5e82b9e7fb801d9bae65cf9c6bbbd1befa
Diffstat (limited to 'native/src')
-rw-r--r--native/src/correction.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/native/src/correction.cpp b/native/src/correction.cpp
index 31493ee7d..02aae9276 100644
--- a/native/src/correction.cpp
+++ b/native/src/correction.cpp
@@ -711,6 +711,9 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const
// \ .
// C \ .
// 0 R1 R2
+ if (factor <= 0) {
+ return -1;
+ }
multiplyRate((int)(factor * 100), &finalFreq);
} else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);