From 4c1dfc62c8d59c7503d3635c96a4c1582f9d9e8a Mon Sep 17 00:00:00 2001 From: satok Date: Thu, 17 Nov 2011 15:46:32 +0900 Subject: [PATCH] Fix a critical underflow in the touch calibration. This is a cherry-pick of Iacc746e1cc97bf3 Bug: 5629373 Change-Id: Ia198fe5e82b9e7fb801d9bae65cf9c6bbbd1befa --- native/src/correction.cpp | 3 +++ 1 file changed, 3 insertions(+) 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);